Cov txheej txheem:

Arduino Browser Raws Kev Tswj Chaw Taws Teeb (linux): 9 Cov Kauj Ruam (nrog Duab)
Arduino Browser Raws Kev Tswj Chaw Taws Teeb (linux): 9 Cov Kauj Ruam (nrog Duab)

Video: Arduino Browser Raws Kev Tswj Chaw Taws Teeb (linux): 9 Cov Kauj Ruam (nrog Duab)

Video: Arduino Browser Raws Kev Tswj Chaw Taws Teeb (linux): 9 Cov Kauj Ruam (nrog Duab)
Video: Step by step guide for Arduino Web editor part 1 2024, Hlis ntuj nqeg
Anonim
Arduino Browser Raws Kev Tswj Chaw Taws Teeb (linux)
Arduino Browser Raws Kev Tswj Chaw Taws Teeb (linux)
Arduino Browser Raws Kev Tswj Chaw Taws Teeb (linux)
Arduino Browser Raws Kev Tswj Chaw Taws Teeb (linux)

Peb muaj menyuam. Kuv hlub lawv rau cov khoom me me tab sis lawv khaws zais cov chaw taws teeb tswj rau lub xov tooj cua thiab TV thaum lawv tso cov menyuam yaus raws. Tom qab qhov no tshwm sim nyob rau niaj hnub rau ntau xyoo, thiab tom qab kuv tus poj niam uas kuv hlub tso cai rau kuv kom muaj Arduino rau Christmas Kuv txiav txim siab tias nws yog lub sijhawm los ua qee yam muaj txiaj ntsig (hauv nws lub qhov muag!) Nrog Arduino. Yog li ntawm no peb muaj qhov ua tiav ntawm qhov ntawd: lub web-based interface rau Arduino uas hloov pauv kuv qhov kev nyob deb thiab tuaj yeem nkag tau los ntawm kuv lub network sab hauv. Thaum kuv xam tawm vim li cas kuv daim thaiv npog ethernet yuav tsis tso cai rau kuv tus arduino khaws daim duab kos Kuv yuav sau daim duab tshiab uas siv daim thaiv npog ethernet ua lub vev xaib, txhais tau tias kuv tsis xav tau apache teeb tsa hauv kuv lub computer. Nyob twj ywm, kuv yuav mus txog ntawd!

Kauj ruam 1: Yam yuavtsum tau kawm uantej

Yam yuavtsum tau kawm uantej
Yam yuavtsum tau kawm uantej

Kho vajtse: Arduino sab: Arduino - Kuv tab tom siv Arduino Uno R2 Breadboard - koj lub khw hluav taws xob hauv ib cheeb tsam, lossis chav ua noj yog tias koj xav tau qhov tseeb ntawm daim ntawv qhia zaub mov Mounting enclosure - Kuv siv cov yas yas qub nrog lub hau kaw pob tshab: Infrared LED - Kuv desoldered ib qho los ntawm kev tswj chaw taws teeb tawg (ua tsaug rau menyuam yaus!) Tus Neeg Txais Hluav Taws Xob - Kuv tau txais kuv los ntawm lub qhov muag pom kev deb deb txuas Transistor - Kuv siv BC547 Resistor - Kuv siv 1.5k ohm kuj tsis paub meej resistor teeb tsa rau 1k ohm Breadboard jumper xov hlau - Kuv tau txais kuv li los ntawm cov khoom tseem ceeb RJ45 cable reel Lub computer sab: Khoos phis tawj siv los ua server USB ua rau Arduino Software: Arduino software - los ntawm arduino.cc irremote library - los ntawm https://www.arcfn.com/2009/08/multi-protocol- infrared -remote -library.html (ua tsaug Ken, ua haujlwm zoo!) Apache web server nrog PHP teeb tsa - apache.org Sab hauv IP chaw nyob - kuv yog 192.168.0.9 Daim duab ntawm koj lub chaw taws teeb tswj - google lossis daim duab thaij ntawm koj lub koob yees duab. Kuv tau txuag kuv li ntawm 200x600 daws teeb meem

Kauj Ruam 2: Tsim Pawg Thawj Coj

Txhim Kho Pawg Thawj Coj
Txhim Kho Pawg Thawj Coj

Siv daim ntawv qhia zaub mov rau arduino tau pom zoo. Kuv tau teeb tsa kuv lub Arduino thiab lub khob cij nyob hauv tib lub thawv thiab txuas txhua tus pins kuv nquag siv ncaj qha mus rau lub khob cij tas mus li. Arduino pins siv rau txoj haujlwm no: 5v, hauv av Digital pins 3, 11 (tus pin 3 tswj IR LED, tus pin 11 txuas rau IR tus txais)

Kauj ruam 3: Schematic

Schematic
Schematic

Cov txheej txheem no yooj yim heev, 4 yam thiab 6 xov hlau. IR LED kev sib txuas: Txuas ib ntawm ob txhais ceg ntawm tus tiv thaiv rau Arduino tus lej digital 3 Txuas lwm ceg ntawm tus tiv thaiv rau lub hauv paus tus pin ntawm transistor (nruab nrab txhais ceg hauv kuv rooj plaub) Txuas tus emitter ntawm transistor rau hauv av Txuas tus neeg nqa khoom ntawm lub transistor mus rau qhov tsis zoo ntawm LED (luv ceg, sab tiaj ntawm LED) Txuas cov ceg zoo (ceg ntev, nkhaus sab) ntawm LED mus rau 5v tus pin IR tus txais kev sib txuas (koj yuav xav tau nrhiav tus pinout rau koj tus neeg txais IR tshwj xeeb): GND tus pin rau hauv av VS tus pin rau 5v VO tus pin rau Arduino digital pin 11

Kauj Ruam 4: Ntxiv Irremote Library rau Arduino Software

Ntxiv Irremote Library rau Arduino Software
Ntxiv Irremote Library rau Arduino Software

irremote yog lub tsev qiv ntawv zoo sau los ntawm Ken Shirriff thiab muaj los ntawm nws qhov blog ntawm https://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html Rub lub tsev qiv ntawv los ntawm https:// arcfn.com/files/IRremote.zip thiab nruab nws zoo li koj xav tau lwm lub tsev qiv ntawv rau arduino. Nws blog muaj ntau cov ntaub ntawv muaj txiaj ntsig hais txog lub tsev qiv ntawv thiab yuav ua li cas rau nruab nws.

Kauj Ruam 5: Sau Cov Codes Los Ntawm Koj Cov Chaw Taws Teeb

Nov yog qhov pib ntawm qhov tsis txaus ntseeg (tab sis zam tsis tau) ib feem: Nias txhua lub pob ntawm cov chaw taws teeb tswj, txuag cov hlua tso tawm thiab kos rau nws mus rau qhov chaw tswj hwm virtual. Koj tsuas yog yuav tsum ua nws ib zaug, cia siab tias yuav siv li 20 feeb lossis li ntawd. Pib kho kab ntawv kom txuag koj cov zis. Tsim ib daim ntawv tshiab thiab ntaus tawm txhua lub pob ntawm koj lub chaw taws teeb tswj, ib kab: Fais Fab Up Down Left Right.. thiab lwm yam Pib Arduino IDE thiab nyem rau ntawm "Files-> Piv txwv-> IRremote-> IRrecvDump" thiab muab xa mus rau koj Arduino. Qhov piv txwv no yuav pov tseg cov lej nyob deb mus rau qhov chaw nres nkoj txuas. Pib Serial chaw nres nkoj saib thiab nias tus yuam sij ntawm koj cov chaw taws teeb tswj. Koj yuav pom ib txoj hlua tshwm nyob rau hauv lub qhov rai saib saib: "Decoded *: * (* bits)". Luam kab no thiab khaws nws rau hauv koj daim ntawv ntawm kab uas tsim nyog. Rov ua dua kom txog thaum koj muaj tag nrho koj cov yuam sij khaws cia hauv kab ntawv. Kuv paub ntau npaum li cas qhov kev lom zem me ntsis no, Kuv tau ua nws ob zaug kom deb li deb: P Tam sim no peb yuav tsum tau tshawb nrhiav me ntsis thiab hloov pauv hauv cov ntawv ntawv: tshawb rau "Decoded" hloov nrog "" search ": 0x" hloov nrog "," tshawb rau "(" hloov nrog "," tshawb rau "khoom)" hloov nrog "" Yog li rau kab xws li: Decoded NEC: 0x000110 (15 khoom) peb tam sim no yuav tsum muaj kab uas hais tias: NEC, 000110, 15

Kauj Ruam 6: Tsim Lub Vev Xaib rau Koj Cov Chaw Taws Teeb

Tam sim no peb xav tau daim duab qhia chaw khawm ntawm koj daim duab ntawm koj cov chaw taws teeb tswj.

Kuv siv https://www.maschek.hu/imagemap/imgmap los qhia cov nyees khawm thiab hloov kho cov cai uas lub vev xaib muab rau koj kom nws ua haujlwm.

Nyem rau "Siv daim duab hauv koj lub computer: [xaiv cov ntawv]", xaiv koj cov duab, nyem [upload], nyem [txais] Tso duab plaub, lub voj voos thiab lwm yam mus rau txhua lub pob. Rau HREF muab /remote.php?command= thiab kab rau lub pob ntawd los ntawm cov ntawv sau piv txwv /remote.php?command=NEC, 000110, 15 Nws yuav yog qhov ntse (thiab pab loj heev hauv kev debugging) yog tias koj tseem sau rau hauv Alt: nrog lub npe khawm tab sis qhov ntawd yog rau koj.

Rov ua dua rau txhua lub pob.

Txhua yam ua tiav? Tom qab ntawd peb yuav txuas ntxiv mus. Hauv qab ntawm nplooj ntawv ntawd yog "Code", nyem rau ntawm qhov ntawd thiab ib lub npov yuav qhib qhia qhov chaws rau daim duab duab. Luam qhov ntawd thiab muab nws tso rau hauv cov ntawv sau tshiab. Nov yog qhov tseem ceeb ntawm peb lub vev xaib.

Nov yog kuv lub vev xaib ua tiav, tsuas yog hloov lub…

nrog koj tus kheej cov cai saum toj no thiab txuag nws li remote.php hauv koj lub vev xaib (/var/www ntawm linux) nrog rau koj cov duab tswj chaw taws teeb. Hloov kab rau koj tus kheej cov duab:

"https://www.w3.org/TR/html4/loose.dtd">

Arduino LED tswj

Kauj Ruam 7: Tshaj Tawm Cov Cai Tswj Chaw Taws Teeb rau Koj Arduino

Rub cov Cai Tswj Chaw Taws Teeb rau koj Arduino
Rub cov Cai Tswj Chaw Taws Teeb rau koj Arduino

Tsim cov duab kos tshiab thiab muab cov cai hauv qab no tso rau hauv nws:/ * * WebRemote * Ib qho IR LED yuav tsum txuas nrog Arduino PWM tus pin 3. * Version 0.1 Lub Xya Hli, 2009 * Cov cai no cai Gregory Fenton, https://labby.co. uk/2012/02/irremote-arduino-experimentation/ * IRremote Library copyright 2009 Ken Shirriff, https://arcfn.com */#include template inline Print & operator << (Print & obj, T arg) {obj.print (arg); rov ob; } boolean xaus = tsis tseeb; tus nqi inData [64]; // Qhov loj me raws li qhov tsim nyog byte index = 0; #define EOP "\ n" IRsend xa rov qab; teeb tsa tsis muaj dab tsi () {Serial.begin (9600); Serial << "Serial port initialised" << EOP; } void loop () {String pch, sType, sTemp; char inChar, sTest, k; koj sBits; ntev sHex; koj, j;. thaum (1) {thaum (Serial.available ()> 0) {inChar = Serial.read (); yog (index == 0) {pch = ""; } yog (inChar == '\ r' || inChar == '\ n' || inChar == '/') // EOP {xaus = muaj tseeb; qhov ntsuas = 0; tawg; } lwm {yog (index <64) // Array loj {pch += inChar; index ++; }}} yog (xaus) {// Parse cov ntaub ntawv hauv inData ntawm no… pch.toUpperCase (); kuv = pch.indexOf ('')! = -1? pch.indexOf (''): pch.indexOf (','); sType = pch.substring (0, i); kuv ++; // hla dhau ',' lossis '' // tam sim no kuv taw tes rau pib hex j = pch.lastIndexOf ('')! = -1? pch.lastIndexOf (''): pch.lastIndexOf (','); // j tam sim no taw tes rau ',' lossis '' tom qab hex sHex = 0; sTemp = pch.substring (i, j); yog (sTemp.substring (0, 2) == String ("0X")) sTemp = sTemp.substring (2); rau (i = 0; kuv <sTemp.length (); i ++) {k = sTemp ; yog (! ((k> = '0' && k = 'A' && k <= 'F'))) tawg; hHex *= 16; yog (k> = '0' && k <= '9') sHex += (k - '0'); lwm yog (k> = 'A' && k <= 'F') sHex + = ((k - 'A') + 10); yog (! ((k> = '0' && k = 'A' && k <= 'F'))) tawg; } sTemp = pch.substring (j+1); sBits = 0; rau (i = 0; kuv <sTemp.length (); i ++) {k = sTemp ; sBits *= 10; yog (k> = '0' && k <= '9') sBits += (k - '0'); } yog (sType.length ()> 0) {Serial << pch << EOP << "Code type:" << sType << "Hex:"; Serial.print (sHex, HEX); Serial << "Khoom:" << sBits; } sendIt (sType, sHex, sBits); pwm = ""; tau = 0; }}} void sendIt (Txoj hlua sType, ntev sHex, int sBits) {rau (int i = 0; i <2; i ++) {if (sType.equals (String ("RC6"))) {irsend.sendRC6 (sHex, swb); } lwm yog (sType.equals (Txoj hlua ("RC5"))) {irsend.sendRC5 (sHex, sBits); } lwm yog (sType.equals (String ("SONY"))) {irsend.sendSony (sHex, sBits); } lwm yog (sType.equals (String ("NEC"))) {yog (! i) irsend.sendNEC (sHex, sBits); } lwm yog (sType.equals (String (""))) {Serial << "Ncua Sijhawm" << EOP; ncua (450); } ncua (30); }}

Kauj Ruam 8: Txuas rau Web Server Los Ntawm Koj Lub Computer

Txuas rau Web Server Los Ntawm Koj Lub Computer
Txuas rau Web Server Los Ntawm Koj Lub Computer

.. lossis xov tooj lossis android lossis ipad lossis xijpeem: mus rau https:// webserver IP chaw nyob/remote.php hauv koj tus browser Rau kuv qhov chaw nyob yog https://192.168.0.9/remote.php tab sis koj yuav tsis ntseeg sib txawv. Yog tias txhua yam ua haujlwm koj yuav tsum pom daim duab ntawm koj lub chaw taws teeb tswj nrog cov nyees khawm koj tuaj yeem nyem rau.

Kauj Ruam 9: Yeem Kauj Ruam: Hloov Kho Koj Cov Ntaub Ntawv Cov Ntaub Ntawv kom Ua Kom Yooj Yim Siv

Yeem Kauj Ruam: Hloov Kho Koj Cov Ntaub Ntawv Cov Ntaub Ntawv kom Ua Kom Yooj Yim Siv
Yeem Kauj Ruam: Hloov Kho Koj Cov Ntaub Ntawv Cov Ntaub Ntawv kom Ua Kom Yooj Yim Siv

Ib kauj ruam kuv tau ua yog los kho kuv cov ntaub ntawv host (/etc/hosts on linux, C: / Windows / System32 / Drivers / etc / hosts on windows). Nco ntsoov tias cov ntaub ntawv no tsuas tuaj yeem kho nyob rau hauv cov lus txib tswj hwm (windows) lossis los ntawm su (linux) Ntxiv kab ip.add.re.ss tej thaj chaw deb hloov ip.add.re.ss nrog tus IP chaw nyob thiab khaws cov ntaub ntawv. Koj yuav tsum tau ua qhov no ntawm txhua lub cuab yeej koj xav nkag mus rau nplooj ntawv web nrog lub npe luv. Tam sim no koj tuaj yeem nkag mus rau cov chaw taws teeb nrog https://remote/remote.php Nov yog kuv thawj qhov kev qhia kom raug, ua siab mos siab muag thiab qhia rau kuv paub yog tias muaj teeb meem yog li kuv tuaj yeem kho lawv.

Pom zoo: