Cov txheej txheem:
- Kauj ruam 1: Qhov & Cov Cuab Yeej
- Kauj Ruam 2: Txiav Daim & Sib dhos
- Kauj Ruam 3: Software - (Arduino)
- Kauj Ruam 4: Software - Neeg Hlau Laptop (WebServer)
- Kauj Ruam 5: Software - (Webpage)
- Kauj ruam 6: Tiav lawm
Video: Ua Lub Vev Xaib Txuas Tus Neeg Hlau (rau Txog $ 500) (siv Arduino thiab Netbook): 6 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:31
Cov lus qhia no yuav qhia koj yuav tsim koj tus kheej lub Vev Xaib Txuas Li Cas (siv Arduino micro-controller thiab Asus eee pc). Vim li cas koj thiaj xav tau Lub Vev Xaib Txuas Nrog? Ua si nrog ntawm cov hoob kawm. Tsav koj tus neeg hlau los ntawm thoob plaws chav lossis thoob plaws lub tebchaws, siv tsis muaj dab tsi ntau dua li Skype thiab lub vev xaib (tsis muaj dab tsi los teeb tsa ntawm lub khoos phis tawj tswj hwm). Tom qab ntawd? Khawb rau hauv software & hloov kho nws txawm li cas los xij koj nyiam, ntxiv GPS kom koj tuaj yeem saib qhov chaw koj tab tom tsav tsheb hauv daim duab qhia chaw, ntxiv cov ntsuas cua sov rau daim duab qhia chaw ntsuas kub hauv koj lub tsev, lossis lub suab sonar txhawm rau ntxiv kev tswj hwm ntawm koj lub vev xaib cov tsav tsheb tuaj yeem thiab khiav tsis tau. Nta:
- Tsis kim - (~ $ 500 yog tias koj yuav khoom txhua qhov tshiab thiab muaj txiaj ntsig zoo dua yog tias koj khawb ib ncig ntawm koj lub thoob rau hauv)
- Thaum nce thiab khiav tswj cov neeg hlau xav tau tsuas yog lub vev xaib - (thiab Skype yog tias koj xav pom qhov chaw koj tab tom tsav tsheb)
- Qhib Qhov Chaw thiab Yooj Yim Yooj Yim - (siv Arduino micro -maub los, Ua haujlwm rau lub web server & txhua qhov software tuaj yeem ua haujlwm ntawm Linux (txhua txoj cai tseem tau hais tawm hnyav kom ua dhia thiab hloov yam yooj yim))
- Modular Design (tsis yog kev sib xyaw ua ke tag nrho, yog tias koj xav siv qhov kev pabcuam sib tham video sib txawv tsis muaj kev txhawj xeeb, lossis yog tias koj muaj lub thwj cim yooj yim dua li Arduino tsuas yog ib qho me me ntawm cov cai thiab tso rau hauv)
Nov yog cov vis dis aus nrawm ntawm kuv Lub Vev Xaib Sib Txuas Robot raug tsav tawm ntawm chav ua noj.
Kauj ruam 1: Qhov & Cov Cuab Yeej
Tsuas yog qee qhov yuav tsum tau ua: Neeg Hlau: Arduino Controlled Servo Robot - (SERB) ($ 175 @ oomlout.com) lossis (ua koj tus kheej)
Qhib qhov chaw neeg hlau uas siv Arduino micro-controller raws li nws lub hlwb
(ib qho dual servo neeg hlau platform nrog arduino tuaj yeem siv tau (xaiv 1) (thov xa xov rau kuv yog tias koj pom lwm txoj kev xaiv) Khoos phis tawj: Asus eee PC 4G ($ 280) (@Best Buy)
Lub laptop pheej yig me me uas zoo rau lub hom phiaj no
(txhua lub khoos phis tawj (lossis lub desktop yog tias koj xav khiav nrog chord) muaj peev xwm khiav Kev kos duab tuaj yeem siv tau) Lub laptop Desk: Laser Txiav Acrylic ($ 25 (@ oomlout)) lossis (tsim koj tus kheej cov kauj ruam 3)
Ob peb daim acrylic ntxiv uas ntsia mus rau (SERB) muab nws lub rooj rau lub khoos phis tawj zaum
Ceev thiab Bols: (muaj nyob ntawm lub tsev muag khoom)
- 3 hli x 10 hli ntsia liaj qhov rooj (x4)
- 3 hli x 15 hli ntsia liaj qhov rooj (x4)
- 3 hli txiv ntseej (x8)
Kauj Ruam 2: Txiav Daim & Sib dhos
Muaj peb qho kev xaiv kom tau txais daim rau koj lub khoos phis tawj lub laptop. Cutting Option 1: (Muas los ntawm oomlout.com)
laser txiav lub rooj thiab cov khoom siv tsis tseem ceeb muaj los ntawm oomlout rau $ 25 (ntawm no)
Qhov Xaiv 2: (Txiav ntawm koj tus kheej lub tshuab txiav laser lossis Ponoko.com)
- Rub tawm cov ntawv hauv qab no (03-WEBB-Acrylic Parts.cdr lossis 03-WEBB-Acrylic Parts (Ponoko P2).eps)
- Txiav lawv los ntawm 3mm (1/8 ") Acrylic
Qhov Xaiv 3: (Scroll Pom)
- Rub cov ntawv pom los ntawm hauv qab no (03-WEBB-ScrollSaw Txawv (A4).pdf (rau A4 daim ntawv loj) lossis 03-WEBB-ScrollSaw Txawv (tsab ntawv).pdf (rau ntawv ntawv me me))
- Txheeb ob zaug tias nws tsis tau ntsuas thaum luam ntawv (los ntawm kev ntsuas cov thawj coj luam tawm)
- Kua nplaum rau ib daim ntawm 3mm (1/8 ") acrylic thiab txiav cov ntawv tawm.
Kev Sib Sau: Rub tawm phau ntawv qhia kev sib dhos (04-WEBB-Assembly Guide.pdf) hauv qab no thiab muab lub rooj laptop tso ua ke.
Kauj Ruam 3: Software - (Arduino)
Rau cov tshiab rau Arduino txheeb xyuas qhov pib zoo pib ntawm Arduino.cc Ua ntej tshaj tawm software khiav ntawm Arduino. Nws yog ib txoj haujlwm yooj yim heev, Arduino ua dab tsi yog saib xyuas nws cov chaw nres nkoj txuas rau cov ntaub ntawv. Dab tsi nws tab tom nrhiav yog kev sib tham 5 bytes ntev.
- Byte 1-3 (Txheeb bytes "AAA")
- Byte 4 Command (Qhia rau arduino yuav ua dab tsi) (Txhawb cov lus txib 'F' - Mus rau tom ntej, 'B' - Rov qab, 'L' - Sab laug, 'R' - Txoj cai, 'S' - Ceev, 'X' - SetSpeedLeft, 'Y' - SetSpeedRight, 'C' - Nres)
- Byte 5 Parameter - Rau qhov txav cov lus txib no yog txhais raws li lub sijhawm sib nrug (Parameter * 100 ms), thiab rau qhov nrawm hais kom ua feem pua ntawm 0-100
Cov cai tau hais qhia meej thiab muab lub hauv paus no ntxiv cov lus txib ntxiv yuav tsum yooj yim dua.
- Rub tawm cov ntawv zip uas txuas nrog. (05-WEBB-Arduino Code.zip)
- Unzip rau koj cov npe Arduino Sketch. (default: Kuv Cov Ntaub Ntawv / Arduino)
- Qhib koj qhov kev txhim kho arduino ib puag ncig thiab xa mus rau koj Arduino.
Luam thiab Muab Tshuaj
- Luam cov cai los ntawm hauv qab no.
- Muab tshuaj txhuam rau hauv Arduino ib puag ncig kev txhim kho.
- Upload rau koj Arduino.
Cov Ntawv Ntxiv: Txoj Haujlwm Arduino
/ * * Arduino Controlled Web Connected Robot (WEBB) - Serial Host * Yog xav paub ntau ntxiv mus ntsib: https://www.oomlout.com/serb * * Tus Cwj Pwm: Arduino mloog nws cov Serial chaw nres nkoj rau kev hais kom ua * hauv hom 254, 88, 88, (COMMAND), (SIJHAWM) * Txhawb Cov Lus txib - & aposF & apos - 70 - Forward * & aposB & apos - 66 - Backward * & aposL & apos - 76 - Left * & aposR & apos - 82 - Txoj cai * & aposS & apos - 83 - Ceev * & aposX & apos - 88 - SetSpeedL * & aposY & apos - 89 - SetSpeedRight * & aposC & apos - 67 - Nres * Lub Sijhawm Txhawb Nqa - 0 - 255 (0 txog 25.5 Thib Ob) tus nqi * 100 milliseconds * sp * Txuas: Txoj Cai Servo Teeb - tus pin 9 * Sab laug Servo Teeb liab - tus pin 10 * * Daim ntawv tso cai: Txoj haujlwm no tau ntawv tso cai los ntawm Creative Commons * Attribution-Share Alike 3.0 Unported License. Txhawm rau * saib daim ntawv theej ntawm daim ntawv tso cai no, mus saib * https://creativecommons.org/licenses/by-sa/3.0/ * lossis xa tsab ntawv mus rau Creative Commons, 171 Thib Ob * Txoj Kev, Suite 300, San Francisco, California 94105, * Tebchaws Asmeskas. * */// ------------------------------------------------------- ---------------------------- // Pib NTAWM ARDUINO SERIAL SERVER PREAMBLE // Txheeb xyuas qhov sib xws sib luag rau txhua lo lus txib (kuj tseem muaj tus lej ascii) #define FORWARD 70 // F#define BACKWARD 66 // B#define LEFT 76 // L#define RIGHT 82 // R#define SETSPEED 83 // S#define STOP 67 // C#define SETSPEEDLEFT 88 // X #define SETSPEEDRIGHT 89 // Y/ *Peb qhov kev txheeb xyuas bytes (siv los khaws cov neeg hlau los ntawm kev teb rau cov lej tsis xwm yeem *cov ntaub ntawv) tam sim no "AAA" */#txhais cov checkByte1 65 // "A" #define checkByte2 65 // "A "#define checkByte3 65 //" A "// -------------------------------------- ------------------------------------ // START OF ARDUINO CONTROLLED SERVO ROBOT (SERB) PREAMBLE#suav nrog #define LEFTSERVOPIN 10 // Tus pin sab laug servo txuas nrog rau#txhais RIGHTSERVOPIN 9 // Tus pin sab xis servo txuas nrogServo leftServo; Servo rightServo; int sab laugSpeed = 50; // tuav qhov ceev ntawm cov neeg hlau laugServo // ib feem pua ntawm 0 thiab 100int rightSpeed = 100; // tuav qhov ceev ntawm cov neeg hlau txoj caiServo // ib feem pua ntawm 0 thiab 100 // Xaus ntawm ARDUINO CONTROLLED SERVO ROBOT (SERB) PREAMBLE // ------------------- ----------------------------------------------------------------------- ----- // Tau txais txhua yam nce thiab khiav tsis muaj teeb tsa () {Serial.begin (9600); // Pib qhov chaw nres nkoj txuas serbSetup (); // teeb tsa lub xeev ntawm txhua qhov tsis tseem ceeb // pins thiab ntxiv servos rau koj daim duab} // Lub phiaj xwm tseem ceeb loopvoid loop () {serbPollSerialPort (); // txuas ntxiv mus saib mus rau qhov chaw nres nkoj txuas // yog tias muaj cov ntaub ntawv nws ua nws} // ------------------------------ ----------------------------------------- // Pib NTAWM ARDUINO SERIAL SERVER ROUTINES/ * * Txheej txheem cov lus txib xa mus rau arduino & aposs serial port */void serbPollSerialPort () {int dta; // sib txawv los tuav tus lej byte yog (Serial.available ()> = 5) {// yog 5 bytes nyob hauv qhov tsis (ntev pf thov tag nrho) dta = Serial.read (); yog (dta = checkByte1) {// Txheeb xyuas thawj zaug kos byte dta = Serial.read (); yog (dta = checkByte2) {// Txheeb xyuas qhov thib ob kos byte dta = Serial.read (); yog (dta = checkByte3) {// Txheeb xyuas qhov thib peb kos byte int hais kom ua = Serial.read (); // Plaub byte yog qhov hais kom ua int param1 = Serial.read (); // Tsib byte yog param1 txhaisCommand (hais kom ua, param1); // xa cov lus thov cais rau nws & tus neeg ua haujlwm tsis pom zoo}}}}}/ * * Siv qhov hais kom ua thiab ntsuas thiab xa nws mus rau tus neeg hlau */tsis muaj dab tsi txhaisCommand (int hais kom ua, int param1) {yog (hais kom == FORWARD) {goForward (); ncua (param1 * 100); goStop ();} // yog tias mus rau lwm qhov yog (hais kom ua == BACKWARD) {goBackward (); ncua (param1 * 100); goStop ();} // yog thim rov qab yog tias (hais kom ua == LEFT) {goLeft (); ncua (param1 * 100); goStop ();} // yog tias tshuav lwm tus yog (hais kom ua == RIGHT) {goRight (); ncua (param1 * 100); goStop ();} // yog tias muaj lwm tus yog (hais kom ua == SETSPEED) {setSpeed (param1);} // yog tias teeb tsa nrawm dua yog tias (hais kom ua == NPE) {goStop ();} // yog tias nres lwm yam yog (hais kom == SETSPEEDLEFT) {setSpeedLeft (param1);} // yog tias teeb tsa sab laug nrawm dua yog (hais kom ua == SETSPEEDRIGHT) {setSpeedRight (param1);} // yog tias teeb tsa txoj cai nrawm dua {// yog tias tsis lees paub hais kom ua me ntsis shimmey goLeft (); ncua (150); goRight (); ncua (150); goStop (); }} // ------------------------------------------------------- -------------------------- // START OF ARDUINO CONTROLLED SERVO ROBOT (SERB) ROUTINES/ * * teeb tsa koj cov arduino los hais rau koj li SERB siv cov txheej txheem suav nrog*/tsis muaj dab tsi serbSetup () {setSpeed (leftSpeed); pinMode (LEFTSERVOPIN, NTUJ) // teeb tsa sab laug servo teeb liab pin // rau pinMode (RIGHTSERVOPIN, OUTPUT); // teeb tsa txoj cai servo tus pin // rau sab laugServo.attach (LEFTSERVOPIN); // txuas sab laug servo rightServo.attach (RIGHTSERVOPIN); // txuas txoj cai servo goStop ();}/ * * teeb tsa qhov nrawm ntawm tus neeg hlau ntawm 0- (nres) thiab 100- (tag nrho nrawm) * NCO TSEG: nrawm yuav tsis hloov qhov nrawm tam sim no koj yuav tsum hloov nrawm * tom qab ntawd hu rau ib qho ntawm txoj kev mus ua ntej kev hloov pauv tshwm sim.*/ void setSpeed (int newSpeed) {setSpeedLeft (newSpeed); // teeb tsa sab laug ceev setSpeedRight (newSpeed); // teeb tsa txoj cai nrawm}/ * * Teem qhov nrawm ntawm lub log sab laug */tsis muaj teeb meem setSpeedLeft (int newSpeed) {yog (newSpeed> = 100) {newSpeed = 100;} // yog tias nrawm dua 100 // ua rau nws 100 yog (newSpeed = 100) {newSpeed = 100;} // yog tias nrawm dua 100 // ua rau 100 yog (newSpeed <= 0) {newSpeed = 0;} // yog tias nrawm dua 0 ua // nws 0 rightSpeed = newSpeed * 0.9; // ntsuas qhov nrawm kom yog}/ * * xa cov neeg hlau mus rau tom ntej */tsis muaj dab tsi goForward () {leftServo.write (90 + leftSpeed); rightServo.write (90 - rightSpeed);} / * * xa cov neeg hlau rov qab * /tsis muaj dab tsi goBackward () {leftServo.write (90 - leftSpeed); rightServo.write (90 + rightSpeed);} / * * xa cov neeg hlau txoj cai * /tsis muaj dab tsi goRight () {leftServo.write (90 + leftSpeed); rightServo.write (90 + rightSpeed);}/ * * xa cov neeg hlau sab laug */tsis muaj dab tsi goLeft () {leftServo.write (90 - leftSpeed); rightServo.write (90 - rightSpeed);}/ * * nres tus neeg hlau */tsis muaj dabtsis goStop () {leftServo.write (90); rightServo.write (90);} // Kawg ntawm ARDUINO CONTROLLED SERVO ROBOT (SERB) ROUTINES // ---------------------------- ----------------------------------------------- ---------------------- Ua Tsaug Ntau
Kauj Ruam 4: Software - Neeg Hlau Laptop (WebServer)
(Kev ua haujlwm yog qhib qhov lus programming thiab ib puag ncig uas yooj yim heev rau pib nrog. Xav paub ntau ntxiv mus ntsib Kev Ua Haujlwm) Lub software uas ua haujlwm ntawm lub laptop neeg hlau kuj tseem yooj yim heev. Nws yog qhov tsis txaus ntseeg web-server (mloog rau lub vev xaib thov los ntawm lub vev xaib), tus neeg siv me me (teeb tsa nws), thiab cov chaw rau hla cov lus txib tau txais los ntawm Web Server mus rau Arduino. (ntawm qhov rais)
- Rub tawm cov ntawv zip hauv qab no (06-WEBB-Processing Webserver (windows exe).zip)
- Unzip nws thiab khiav cov ntaub ntawv.exe (_WEBB_WebServer_RobotComputer.exe)
Kho kom raug hauv Kev Ua:
- Rub tawm cov ntawv zip hauv qab no (06-WEBB-Ua Tus Kheej Lub Vev Xaib (cov ntaub ntawv qhov chaw).zip)
- Unzip qhov twg ntawm koj lub computer.
- Qhib Kev Ua Haujlwm ib puag ncig thiab qhib (_WEBB_WebServer_RobotComputer.pde)
Mus Xeem:
- Khiav qhov kev pab cuam.
- Hauv lub npov #1 yuav muaj cov npe ntawm cov chaw nres nkoj muaj nyob hauv koj lub khoos phis tawj (nyem rau ntawm ib qho uas koj Arduino tau ua tiav.) comm chaw)
- Hauv lub npov #2 ntsuas kom pom tias koj Arduino txuas nrog. Nyem ib qho ntawm cov xub thiab cia siab tias koj tus neeg hlau yuav txav mus rau hauv qhov kev taw qhia nyem rau ib nrab thib ob.
- Hauv lub npov #3 nyem qhov "Pib" khawm kom pib lub web server.
- Qhib lub vev xaib (ntawm Robot Laptop) thiab mus ntsib https://127.0.0.1:12345/ControlPage.html (cia siab tias tswj lub vev xaib nrog cov nyees khawm ntawm nws yuav tshwm) -Cov lus qhia yuav ua li cas siv nplooj ntawv no hauv cov kauj ruam tom ntej -
Dab tsi tshwm sim:
- Lub Vev Xaib mloog rau chaw nres nkoj 12345 rau http thov (dab tsi yog xa thaum koj ntaus hauv lub vev xaib chaw nyob)
- Muaj ob hom kev thov nws teb rau.
1. Nws mloog rau "ControlPage.html" thiab yuav xa cov tswj lub Vev Xaib 2. Nws mloog rau kev thov ntawm daim ntawv "/thov? Hais kom ua = F & param1 = 100" (cov lus txib no tau cais thiab xa mus rau Arduino (qhov piv txwv no yuav tshwm sim) hauv tus neeg hlau mus tom ntej rau 10 vib nas this) Cov ntawv txuas ntxiv: (Tus lej rau WebServer)
/ * * Arduino Controlled Web Connected Robot (WEBB) - Webserver * Xav paub ntau ntxiv mus ntsib: https://www.oomlout.com/serb * * Tus cwj pwm: Qhov program mloog rau http (webpage) thov hauv daim foos * "/thov ? command = F & param1 = 100 "thiab tom qab ntawd xa lawv mus rau * Arduino * Cov Lus Hais Txhawb - & aposF & apos - 70 - Forward * & aposB & apos - 66 - Backward * & aposL & apos - 76 - Left * & aposR & apos - 82 - Txoj cai * & aposS & apos - 83 - Ceev * & aposX & aposX - 88 - SetSpeedLeft * & aposY & apos - 89 - SetSpeedRight * & aposC & apos - 67 - Nres * param1 & aposs - 0 - 255 (0 txog 25.5 Seconds) tus nqi * 100 milliseconds * * kuj ua haujlwm tswj lub vev xaib rau browser yog nug txog ControlPage.html * * Kev Ua Haujlwm: 1. Nyem rau ntawm Comm chaw nres nkoj koj Arduino txuas nrog * 2. Siv cov khawm ntsuas kom pom tias koj cov arduino mloog * (yuav txav mus rau qhov kev nyem nyem rau ib nrab thib ob) * 3. Nyem Pib thiab koj lub vev xaib yuav mloog rau kev thov * * * Daim ntawv tso cai: Cov haujlwm no tau ntawv tso cai los ntawm Creative Commons * Attribu tion-Qhia Ib Leeg 3.0 Unported License. Txhawm rau * saib daim ntawv theej ntawm daim ntawv tso cai no, mus saib * https://creativecommons.org/licenses/by-sa/3.0/ * lossis xa tsab ntawv mus rau Creative Commons, 171 Thib Ob * Txoj Kev, Suite 300, San Francisco, California 94105, * Tebchaws Asmeskas. * */import processing.serial. *; // ntshuam lub tsev qiv ntawv txuas mus siv Serial (rau tham nrog Arduino) ntshuam processing.net.*; // ntshuam lub tsev qiv ntawv nqa los siv Server (rau tham nrog internet)/ * Serial Port Related Variables */int serialPortIndex = -1; // qhov ntsuas ntawm qhov chaw nres nkoj uas peb siv hauv Serial.list () listString commOptions; // Ib qhov sib txawv los khaws Serial.list () nyob rau hauv yog li tsis muaj qhov yuav tsum tau pov npav // cov ntawv txuas txhua lub sijhawm peb xav kom rov ua dua nws (kev xaiv tsa ua rau // dhia hauv arduino servos) SerialPort; // Ua rau qhov chaw nres nkoj hauv qhov chaw nyob thoob plaws qhov kos duab no/ * Cov duab thiab ua piv txwv cuam tshuam */PFont font; // ua font rau pej xeem yog li nws tsuas xav tau thauj khoom ib zaug (Arial-72)/ * Network cuam tshuam txog qhov sib txawv */Server wServer; // Tus neeg rau zaub mov uas saib xyuas lub vev xaib thov chaw nres nkoj = 12345; // Qhov chaw nres nkoj tus neeg rau zaub mov mloog toint cycleCount = 0; // Suav tus naj npawb ntawm lub sijhawm kos lub voj ua haujlwm (siv rau // ua kom cov ntawv "khiav")/ * Cov Khoom Siv Hluav Taws Xob */PImage bg; // Cov duab keeb kwm yav dhau tam sim no WEBB-background.png/ * * Khawm cuam tshuam txog qhov sib txawv * (cov nyees khawm tau siv los ntxhib heev, cov thawv ntim tau khaws cia thiab cov duab thiab cov ntawv yog * kos rau ntawm cov duab tom qab) piv txwv. txav khawm hloov pauv yuav tsis txav cov tsos ntawm cov nyees khawm */Khawm comm1; Khawm comm2; Khawm comm3; Khawm comm4; // Cov nyees khawm xaiv qhov tseeb qhov chaw nres nkoj khawm khawm; Khawm txoj cai; Khawm sab laug; Khawm nqes; // Cov lus qhia nyees khawm txhawm rau ntsuas yog tias tus neeg hlau tau tebButton webServer; // Lub pob pib webServer/ * * teeb tsa evrything li */tsis muaj teeb tsa teeb tsa () {frameRate (5); // Ua kom cov duab kos qis me ntsis nws tsis zoo li kev sau se ntawm cov kab ke bg = loadImage ("WEBB-background.png"); // Qhib cov duab keeb kwm yav dhau (khaws cia hauv daim duab kos) loj (700, 400); // Teev qhov loj me ntawm daim duab qhov rai font = loadFont ("ArialMT-72.vlw"); // Lo lus font peb yuav siv hla qhov kos duab no commOptions = Serial.list (); // Polls Serial ports thiab tau txais cov npe ntawm cov chaw nres nkoj muaj // (ua qhov no tsuas yog ib zaug ua rau cov neeg hlau los ntawm kev sib tw txhua lub sijhawm nws & aposs // qhov chaw nres nkoj txuas tau raug xaiv) defineButtons (); // Txhais lub thawv uas muaj ciam rau txhua lub pob tom qab (bg); // pleev xim rau cov duab tom qab (daim duab no muaj tag nrho cov duab nraaj ntawm nws)}/ * Cov duab kos loj lub voj */kos tsis muaj dabtsis () {yog (cycleCount == 0) {//- hu kos ib txwm kosCommBox (); // Kos cov cim hauv Comm Box (lub thawv 1) drawTestBox (); // Kos tag nrho cov ntsiab lus hauv Xeem Ntawv (lub thawv 2) kosWebServerBox (); // Kos tag nrho cov ntsiab lus hauv WebServer Box (lub thawv 3)} //- hu ua haujlwm ib txwm ua pollWebServer (); // Polls lub vev xaib saib seb puas muaj kev thov tau los ntawm lub network} // ------------------------------ ---------------------------------------------- // Pib ntawm kos cov txheej txheem (faib ib qho tsuas yog ua kom cov cai zoo dua los nyeem)/ * * Kev kos duab hloov tshiab niaj hnub (ua tiav txhua lub voj voog) rau cov khoom hauv lub thawv comm (lub npov 1) */tsis muaj dab tsi kosCommBox () {sau (0, 0, 0); // Teev qhov sau rau dub textFont (font, 15); // Teeb tus font rau qhov loj me rau (int i = 0; i 0) {running = running + ".";} // Tus naj npawb ntawm cov ntawv teev raws CycleCount yog ((cycleCount /1)> 1) { running = running + ".";} if ((cycleCount / 1)> 2) {running = running + ".";} if ((cycleCount / 1)> 3) {cycleCount = 0;} text (khiav, 520, 210); } cycleCount ++; // Txhua lub sijhawm los ntawm kev sib twCount tau nce ntxiv los ntawm ib qho} // Xaus Kev Kos cov txheej txheem // ------------------------------- ------------------------------ // ---------------------- Ua tsaug ------------------------------------------- // Pib Kev Pabcuam niaj hnub/ * * mousePressed yog hu ua txhua lub sij hawm nas tau nias qhov no * kuaj xyuas yog tias nas nyob hauv ib qho ntawm lub pob khawm khawm * thiab yog tias nws yog qhov tsim nyog niaj hnub hu ua */tsis muaj dab tsi nas Pressed () {yog (comm1.pressed ()) { updateSerialPort (0);} // Hloov pauv mus rau qhov chaw nres nkoj comm ntawm qhov ntsuas 0 hauv Serial.list () lwm qhov yog (comm2.pressed ()) {updateSerialPort (1);} // Hloov pauv mus rau qhov chaw nres nkoj comm ntawm qhov ntsuas 1 hauv Serial.list () lwm yam yog (comm3.pressed ()) {updateSerialPort (2);} // Hloov pauv rau qhov chaw nres nkoj comm ntawm qhov ntsuas 2 hauv Serial.list () lwm tus yog (comm4.pressed ()) {updateSerialPort (3);} // Hloov pauv mus rau qhov chaw nres nkoj comm ntawm qhov ntsuas 3 hauv Serial.list () lwm qhov yog (up.pressed ()) {sendRobotCommand ("F", 5);} // Xa cov lus txib kom txav tus neeg hlau mus rau 0.5 vib nas this ntxiv yog (sab laug.pressed ()) {sendRobotCommand ("L", 5);} / /Xa cov lus txib kom txav tus neeg hlau Sab laug rau 0.5 vib nas this yog tias (right.pressed ()) {sendRobotCommand ("R", 5);} // Xa cov lus txib kom txav tus neeg hlau kom raug rau 0.5 vib nas this ntxiv yog tias (nqis. nias ()) {xaRobotCommand ("B", 5);} // Xa cov lus txib kom txav tus neeg hlau rov qab rau 0.5 vib nas this yog tias (webServer.pressed ()) {startWebServer ();} // Pib lub webServer cycleCount = 0; tom qab (bg); // Rov ua dua daim duab keeb kwm yav dhau (daim duab no muaj tag nrho cov duab nraaj rau nws) kos ();}/ * * Hu ib zaug ua tiav nws tshawb xyuas Tus Neeg rau zaub mov kom pom tias muaj ib qho tos txuas * yog tias muaj qhov tos txuas nws rub tawm tawm qhov kev thov thiab dhau nws mus rau qhov parseRequest (String) * niaj hnub mus hle cov ntawv ntxiv. Qhov no yog tom qab ntawd xa mus rau qhov kev txhais lus thov (Txoj hlua) niaj hnub rau * hu rau qhov tsim nyog ua ntu zus (piv txwv li xa cov lus qhia rau neeg hlau).* * Kev thov tau dhau los ntawm kev nkag mus rau lub khoos phis tawj chaw nyob thiab chaw nres nkoj rau hauv lub vev xaib * Rau lub tshuab hauv zos "https://127.0.0.1:12345/request?command=F¶m1=100" * * Piv Txwv Thov: * Tau/thov? hais kom = F & param1 = 100 HTTP/1.1 * Tus Neeg Sawv Cev: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, zoo li Gecko) * Txais: * // * * Txais-Lus: en-US, en * Txais-Charset: ISO-8859-1, *, utf-8 * Txais-Nkag Siab: gzip, deflate, bzip2 * Tus tswv tsev: 127.0.0.1:12345 * Kev Sib Txuas: Khaws-Nyob * * Piv Txwv Teb (rau kev thov ua tiav) * HTTP/1.1 200 OK * Kev sib txuas: kaw * Cov ntsiab lus-hom: ntawv/html * * hais kom ua: F param1: 100 */tsis muaj dab tsi pollWebServer () {yog (wServer! = tsis muaj)) // Yog tias lub webServer tab tom khiav Client thov = wServer.available (); // Thauj cov Client tom ntej hauv kab hauv // server (tsis muaj yog tias tsis muaj kev thov tos) yog (thov! = Tsis muaj) {// yog tias muaj cov txheej txheem thov nws Txoj hlua fullRequest = thov.readString (); // Khaws thov cov ntsiab lus raws li txoj hlua Txoj hlua ip = thov.ip (); // Khaws cov neeg siv IP chaw nyob raws li txoj hlua txoj hlua requestString = parseRequest (fullRequest.toUpperCase ()); // Tshem tawm txhua qhov ntxiv // cov ntaub ntawv tawm tsuas yog txoj hlua thov (ntawv tom qab tau txais) // (hloov mus rau rooj plaub loj kom ua txoj hlua yooj yim dua) yog (thovString.indexOf ("thov?")! = -1) { // Txheeb xyuas yog tias qhov kev thov muaj "REQUEST?" Txoj hlua teb = txhais lusRequest (requestString); // Xa daim ntawv thov mus rau tus neeg txhais lus thov thov.write ("HTTP/1.1 200 OK / nConnection: kaw / nContent-Type: text/html / n / n" + teb); // Xa cov lus teb 200 los hais qhov kev thov raug daws // ua haujlwm thiab "teb" txoj hlua raws li cov lus teb wServer.disconnect (thov); // Disconnects Client} lwm yog (thovString.indexOf ("CONTROLPAGE")! = -1) {// Yog hais tias qhov kev thov yog rau tswj lub vev xaib String webPageArray = loadStrings ("WEBB -ControlPage.html"); // Loads tswj webPage los ntawm / data / WEBB-ControlPage.html // (thauj khoom raws li kab ntawm kab) Txoj hlua webPage = ""; // Txhawm rau kho kom yooj yim lub vev xaib tau sab laug nrog // kab tawg yog li qhov no rau lub voj striops cov kab tawm rau (int i = 0; kuv portIndex) {// yog tias dhau portIndex yog qhov ntsuas tau siv hauv Serial.list () // (piv txwv li tsis xaiv peb hauv cov npe ntawm ob) serialPortIndex = portIndex; // teeb tsa qhov sib txawv serialPortIndex rau qhov tshiab serialport index // (qhov no yog siv los tso saib cov dot nyob ib sab ntawm qhov chaw nres nkoj nquag)} yog tias (serialPortIndex! = -1) {// xyuas kom paub tseeb tias chaw nres nkoj tau raug xaiv qee lub sijhawm dhau los yog (serialPort! = null) {serialPort.stop ();} // yog tias qhov chaw nres nkoj Serial twb tau siv lawm nres nws ua ntej thauj khoom ib qho tshiab serialPort = Serial tshiab (qhov no, Serial.list () [serialPortIndex], 9600); // Tsim cov khoom siv tshiab kom sib txuas lus nrog Arduino 9600 Baud}}/ * * Siv cov ntawv thov (ex: "thov? Command = F & param1 = 100") thiab yuav tshem tawm cov lus txib * thiab param1 thiab xa nws mus rau arduino (ntxiv cov kev txwv lossis tsis yog cov lus txib arduino yuav ua tiav ntawm no) */Txoj hlua txhais lusRequest (Txoj hlua thovString) {Txoj hlua returnValue = "OK"; // Npaj ib qhov returnValue variable string hais kom ua; // Tom ntej no peb kab ntawv rho tus nqi tom qab "hais kom ua =" // (kab ntawv ntxiv yog qhov hais kom ua qhov ntsuas nyob ntawm // kawg ntawm qhov kev thov thiab tsis ua raws los ntawm & ((requestString.indexOf ("COMMAND =")! = -1) {command = requestString.substring (requestString.indexOf ("COMMAND =") + "COMMAND =". Length ());} else {command = "Z";} if (command.indexOf (" & ")! = -1) {command = command.substring (0, command.indexOf (" & "));} else {command = command;} String param1String; // Next three lines extract the value after" param1 = "// (kab ntawv ntxiv yog qhov hais kom ua qhov ntsuas nyob ntawm // qhov kawg ntawm qhov kev thov thiab tsis ua raws los ntawm & (thovString.indexOf (" PARAM1 = ")! = -1) {param1String = requestString.substring (thovString.indexOf ("PARAM1 =") + "PARAM1 =". ntev ());} ntxiv {param1String = "0";} yog (param1String.indexOf ("&")! = -1) {param1String = param1String.substring (0, param1String.indexOf ("&"));} ntxiv {param1String = param1String;} int param1 = Integer.parseInt (param1String); // Hloov qhov param1 String rau hauv integer sendRobotCommand (hais kom ua, param1); // Xa cov lus txib mus rau niaj hnub uas xa nws mus rau Arduino returnValue = "hais kom ua:" + hais kom ua + "param1:" + param1; // tam sim no tsuas yog cais cov lus txib tab sis xa // raws li html yog li kev teeb tsa tuaj yeem suav nrog returnValue;}/ * * Siv qhov hais kom ua (tam sim no ib tsab ntawv) thiab qhov ntsuas (ib byte 0-255) thiab xa mus rau arduino * uas yog mloog thiab rov hais dua * Currrently Txhawb Nqa Cov Lus txib * F - */tsis muaj dab tsi xaRobotCommand (Txoj hlua hais kom ua, int param1) {println ("command:" + command + "time:" + param1); Txoj hlua checkString = "AAA"; yog (serialPort! = null) {serialPort.write (checkString + hais kom ua); serialPort.write (byte (param1)); }} // Xaus kev teeb tsa/tsis nquag hu ua niaj hnub // ----------------------------------- ----------------------------------------------------------------------- // Piv txwv khawm thiab RectButton code los ntawm kev ua piv txwv piv txwv nrog qee qhov kev hloov pauv // ua rau feem ntau yooj yim dua thiab tshem tawm yob dhau cov duab // https://processing.org/learning/topics/buttons.html (2008-09-23) Chav kawm khawm {int x, y; int dav, qhov siab; Khawm (int ix, int iy, int iwidth, int iheight) {x = ix; y = yog; dav = iwidth; qhov siab = qhov siab; } boolean nias () {yog (overRect ()) {rov muaj tseeb; } lwm {xa rov qab tsis tseeb;}} boolean overRect () {yog (mouseX> = x && mouseX = y && mouseY <= y+height) {rov muaj tseeb; } lwm {rov cuav; }}}
Kauj Ruam 5: Software - (Webpage)
Zoo peb tab tom yuav luag tiav txhua yam uas tshuav yog tham nrog koj tus neeg hlau. Txhawm rau Tham Nrog: (dhau lub network hauv zos -ntawm windows-)
- Tshawb nrhiav qhov chaw nyob IP ntawm lub khoos phis tawj laptop. Txhawm rau ua qhov no mus rau "Start / Programs / Accesories / Command Prompt" thiab thaum lub davhlau ya nyob twg qhov rai qhib hom "ipconfig". Sau "IP Chaw Nyob" thiab tig mus rau lwm lub khoos phis tawj ntawm koj lub network.
- Qhib lub vev xaib, ntaus "https:// (tus neeg siv lub computer ip): 12345/ControlPage.html
- Cov nplooj ntawv tswj hwm lub vev xaib yuav tsum thauj khoom, hauv "IP Address" lub npov ntaus cov neeg hlau khoos phis tawj ip.
- Pib tswj koj tus neeg hlau.
Kom Tau Tham: (hla internet) Tam sim no koj muaj nws ua haujlwm hauv zos tau txais nws tham hauv is taws nem tsuas yog ob peb kauj ruam luv luv xwb.
- (cov kauj ruam nyuaj tshaj plaws) Teeb tsa Chaw Xa Mus - Koj lub khoos phis tawj yuav tsum tau mloog hauv internet ntau dua li tsuas yog lub network hauv zos. Txhawm rau ua qhov no koj yuav tsum qhia koj lub router kom dhau qee qhov kev thov hla mus rau lub khoos phis tawj tswj hwm tus neeg hlau. Qhov no yog qhov nyuaj me ntsis thiab mus deb dhau qhov kev qhia ntawm Cov Lus Qhia no. Txawm li cas los xij yog tias koj mus ntsib PortForward.com lawv yuav muab txhua yam koj xav paub txog teeb tsa koj lub router (koj yuav tsum xa mus rau chaw nres nkoj 12345 rau koj lub laptop neeg hlau)
- Tom ntej pom koj tus IP IP (mus ntsib WhatIsMyIP.com)
- Thaum kawg tua hluav taws skype teeb tsa hu xov tooj thiab tau txais txhua tus neeg koj tab tom tham nrog mus ntsib "https:// (internet IP): 12345/ControlPage.html"
- Ntaus hauv internet IP rau hauv "IP Chaw Nyob" lub thawv hauv lub vev xaib tswj hwm thiab koj Lub Vev Xaib Txuas Txuas tau tsav los ntawm qhov deb.
Kauj ruam 6: Tiav lawm
Zoo ntawd yog nws. Kuv vam tias koj muaj sijhawm lom zem tsav koj lub neeg hlau los ntawm qhov deb. Yog tias koj muaj teeb meem nrog software lossis kho vajtse xav tawm lus tawm thiab kuv yuav sim thiab pab koj.
Pom zoo:
$ 10 Lub Vev Xaib Lub Vev Xaib Kho: 5 Kauj Ruam (nrog Duab)
$ 10 Lub Vev Xaib Lub Vev Xaib Tsis Zoo: Zoo, kuv tau ua nws dua. Kuv tau tawg kuv qhov screen. Rau cov ntawm koj uas yuav nco tau, kuv tau ua qhov no tsuas yog ib xyoos dhau los thiab xav tau kev txhim kho ib ntus kom coj kuv mus txog thaum kuv tuaj yeem hloov pauv cov muab kev pabcuam thiab tau txais xov tooj tshiab. Nws tau ua haujlwm zoo, nws tau kav rau
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej
Web-Txuas Txuas SMART LED Animation Moos Nrog Lub Vev Xaib Tswj Vaj Huam Sib Luag, Lub Sijhawm Neeg Ua Haujlwm Sib Koom: 11 Cov Kauj Ruam (nrog Duab)
Web-Txuas Txuas SMART LED Animation Clock Nrog Lub Vev Xaib Tswj Vaj Huam Sib Luag, Lub Sijhawm Neeg Ua Haujlwm Sib Koom: Zaj dab neeg ntawm lub moos no rov qab mus ntev-ntau dua 30 xyoo. Kuv txiv pioneered lub tswv yim no thaum kuv tsuas yog 10 xyoo, ntev ua ntej LED kiv puag ncig - rov qab thaum LED qhov twg 1/1000 qhov ci ntawm lawv qhov muag tsis pom kev tam sim no. Qhov tseeb
Txhua Yam Txog Kev Tsim Lub Vev Xaib Lub Vev Xaib: 5 Kauj Ruam
Txhua Yam Txog Kev Tsim Lub Vev Xaib Lub Vev Xaib: Lub vev xaib pub dawb no yog daim ntawv uas koj siv los npaj phiaj xwm kev tsim kho cov ntsiab lus zoo ua kom pom tseeb cov ntsiab lus lub vev xaib. Daim qauv txheej txheem no tau tsim nrog kev yooj yim siv cov khoom siv hauv Microsoft Excel txawm hais tias muaj ntau yam software sib txawv
Lub hauv paus tseem ceeb ntawm Lub Vev Xaib-raws li Lub Vev Xaib: 7 Kauj Ruam
Cov Hauv Paus Ntawm Lub Vev Xaib-raws li Lub Vev Xaib: Cov lus qhia no yuav qhia koj cov hauv paus ntawm kev tsim lub vev xaib nrog divs li cas. Vim tias cov ntxhuav siv rau kev teeb tsa yog qhov phem!: PTo kom nkag siab cov lus qhia no, koj yuav tsum paub qhov yooj yim html thiab css. Yog tias koj tsis nkag siab qee yam, xav tias dawb rau