Cov txheej txheem:
- Kauj Ruam 1: Cov Cuab Yeej thiab Cov Khoom
- Kauj ruam 2: Khoos phis tawj khoos phis tawj
- Kauj Ruam 3: Schematics
- Kauj ruam 4: Programming Arduino
- Kauj Ruam 5: Ua Nws Tus Hitcounter
- Kauj Ruam 6: Xaus
Video: Arduino XMAS Hitcounter: 6 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:30
Christmas yog los ze dua, yog li ntawm no yog kuv txoj kev koom tes ua rau koj nyob zoo. Nws yog blog hitcounter, uas ua lub tswb nrov. Txhais lus. Nws tso lub ntsej muag luag ntxhi rau koj lub ntsej muag, txhua lub sijhawm ib tus neeg tsoo koj li blog.
Nws suav nrog Arduino lub rooj tsavxwm, lub tswb, lub servo thiab ob peb kab ntawm cov cai hauv c, nab hab sej thiab php. Feem ntau ntawm cov khoom yog ib txwm muaj thiab yuav tsum yooj yim kom tau txais.
Kauj Ruam 1: Cov Cuab Yeej thiab Cov Khoom
Yog li dab tsi xav tau?
- Pawg Arduino. Kuv tau txais Arduino Diecimila los ntawm Adafruits. Lub sijhawm ntawd muaj cov khoom lag luam pheej yig tiag tiag thiab siv tau tawm, xws li qhov pob txha pob txha tiag tiag los ntawm Cov Khoom Siv Niaj Hnub No, tshwj xeeb tshaj yog tias koj xav siv lawv ntawm lub khob cij.
- Ib lub cav servo. Ib qho servo yuav ua. Kuv tau siv qhov qub uas tau siv hauv kuv txoj haujlwm yav dhau los.
- Tswb. Nyiam ib qho uas me me txaus los tuav nws nrog servo.
- Ob daim ntawv ntawv. Ib qho loj los tuav lub tswb thiab ib qho me me los tsim lub tshuab ua kom nrov nrov lub tswb.
- Cov xov txuas rau servo nrog Arduino.
- Ib lub website. Qhov tseeb nws tsis tas yuav yog lub vev xaib lossis blog. Qhov tseeb txhua yam uas tuaj yeem suav tau, yuav ua haujlwm.
- Ib lub PC lossis Mac txuas rau Arduino pawg thawj coj nrog blog lossis lub vev xaib.
Koj yuav xav tau cov hlau txuas, yog tias cov xov hlau tsis tuaj yeem txuas ncaj qha rau Arduino.
Kauj ruam 2: Khoos phis tawj khoos phis tawj
Lub tswb yog tuav los ntawm daim ntawv khov. Cov ntawv me me yog siv los ua ib hom caj npab uas tau txuas rau lub tshuab servo.
Nco tseg, tias koj xav khoov daim ntawv uas tuav lub tswb nyob rau hauv ib txoj kev, uas twb tau me ntsis co tsim cov ding.
Kauj Ruam 3: Schematics
Yog tsis muaj tiag schematic. Tsuas yog xa cov servo motor rau Arduino. Lub servo muaj peb lub xov hlau:
- daj lossis txiv kab ntxwv: teeb liab
- liab: VCC
- xim av: GND
Cov xim liab thiab xim av tau txuas nrog raws tus pin ntawm Arduino (5V thiab GND). Cov txiv kab ntxwv yog xaim rau tus pin 2. Nws yuav teeb liab lub servo uas yuav tsum tau tig. Koj yuav xav tau txuas cov kab txuas me me rau cov xov hlau yog tias cov xov hlau tsis haum ncaj qha rau hauv Arduino lossis servo.
Kauj ruam 4: Programming Arduino
Arduino Yog tias koj yog tus tshiab rau Arduino, nws yog lub rooj tsav xwm me, ua ke nrog AVR microcontroller. Nws yog qhov tsim nyog rau hack thiab cuam tshuam nrog koj ib puag ncig. Ntau yam uas nyuaj nrog microcontrollers yog qhov yooj yim dua nrog Arduino. Qee qhov zoo:
- tsis xav tau cais cov cuab yeej programming (programmer)
- los nrog kev txhim kho ib puag ncig ib puag ncig (IDE)
- khiav ntawm txhua lub platform, Windows, Mac, Linux.
- txuas yooj yim rau koj lub PC nrog USB
- kho vajtse yog qhov qhib (tab sis lub npe Arduino tsis yog)
- muaj zej zog zoo
Xav paub ntau ntxiv tuaj yeem nrhiav tau ntawm tus nom Arduino lub vev xaib. Nco ntsoov, txhawm rau txheeb xyuas John's Arduino cov lus qhia kom paub meej ntxiv txog yuav pib li cas nrog Arduino. Qhov software ua dab tsi? Qhov me me ntawm software uas tau muab tso rau hauv Arduino, tswj hwm servo. Nws tau txais ib qho bytes ntawm qhov txuas txuas hauv USB cable. Yog tias nws tau txais tus nqi 5, nws txav lub servo caj npab tsib zaug tawm thiab rov qab. Yog li tus nqi siab tshaj plaws xa yog 255. Program Ardiuno Yog li kuv xav tias koj tau rub tawm thiab teeb tsa qhov tseeb Arduino IDE los ntawm Arduino.cc. Txog tam sim no nws yog version 0010 Alpha. Txhawm rau tsav lub servo kom yooj yim dua koj yuav tsum rub lub tsev qiv ntawv. Koj tuaj yeem pom nws ntawm Arduino Chaw Ua Si. Unzip nws thiab muab daim nplaub tshev tso rau hauv…/arduino-0010/hardware/libraries/.
- Txuas Arduino rau koj lub PC nrog USB cable.
- Qhib IDE thiab pib kos duab tshiab. Sketch yog Arduino hais lus rau txoj haujlwm. Xaiv Cov Ntaub Ntawv -> Tshiab.
- Xaiv cov khoom siv uas tsim nyog (Cov Cuab Yeej -> Serial Port). Qhov no nyob ntawm koj ib puag ncig, rau kuv nws yog /dev/tty.usbserial-A4001JAh.
- Rub tawm cov ntaub ntawv txuas nrog thiab muab tso rau hauv daim duab tshiab. Ntaus khawm txuag.
- Ntaus lub pob kom paub tseeb. Qhov no suav koj cov duab kos rau hauv cov ntaub ntawv hex uas tuaj yeem xa mus rau koj li Arduino.
- Ntaus lub pob upload kom hloov koj daim duab mus rau Arduino.
Kuaj Tam sim no koj tus lej suav tau npaj rau qee qhov ua. Cia saib seb nws puas ua haujlwm.
- Ntaus lub khawm saib xyuas.
- Xaiv lub thawv ntawv nyob ib sab ntawm lub pob xa.
- Ntaus tus yuam sij tab thiab xa nws.
- Txog tam sim no servo caj npab yuav tsum txav mus tom ntej thiab rov qab.
Phaw. Qhov ntawd yog qhov nyuaj tshaj plaws. Txog tam sim no koj tuaj yeem xa ib qho byte mus rau Arduino thiab cov kev pabcuam cuam tshuam ntawm koj. Tom ntej no yog nrhiav qee yam uas koj xav ua kom lub tswb nrov. Peb yuav luag tiav.
Kauj Ruam 5: Ua Nws Tus Hitcounter
Txhawm rau ua nws tus lej rau koj lub vev xaib, peb xav tau ob daim ntawv me me. Ib ob tsim thiab saib xyuas ntawm lub txee thiab thib ob kom nqa tus nqi ntawm lub txee thiab xa mus rau Arduino.
Nco tseg: Yog tias koj tsis txaus siab nrog Python lossis PHP, cov ntawv sau tuaj yeem yooj yim xa mus rau koj cov lus nyiam lus. Qhov txee Ntawm no yog tsab ntawv PHP me me, uas nyeem tus nqi ntawm cov ntawv (hitcounter.txt), nce nws thiab sau nws rov qab rau cov ntaub ntawv. Qhov ntawd yog txhua yam, uas xav tau. Cov ntaub ntawv no tuaj yeem khaws tseg raws li counter.php ntawm koj lub server piv txwv. Tom qab ntawd koj tuaj yeem ua rau suav nrog koj tus webbrowser taw rau https://www.youdomain.com/counter.php. Kuv suav nrog cov ntawv me me no hauv kuv blog wordpress. $ hits = file ($ count_my_page); $ ntaus = txiav ($ hits [0]); $ ntaus ++; $ fp = fopen ($ count_my_page, "w"); fputs ($ fp, "$ ntaus"); fclose ($ fp); ncha $ ntaus; ?> Cov kua nplaum code Cov kab ntawv tom ntej no yog siv los nqa lub txee. Kuv siv Python tab sis txhua yam yuav tsum ua haujlwm. Nws qhib qhov txuas HTTP thiab nqa cov hitcounter.txt. Yog tias tus nqi tau hloov txij li qhov nqa mus zaum kawg, qhov sib txawv tau suav thiab thawb mus rau Arduino. Qhov no ua tiav txhua kaum vib nas this kom txog thaum koj cuam tshuam tsab ntawv nrog crtl-c. Hloov kho myUrl thiab txuas txuas hauv qab no rau koj cov kev xav tau. # # nqa lub txee # ntshuam lub sijhawm ntshuam urllib ntshuam txuas # usb txuas txuas mus rau arduino ser = serial. Serial ('/dev/tty.usbserial-A4001JAh', 9600) myUrl = 'https://tinkerlog.com/hitcounter.txt 'last_counter = urllib.urlopen (myUrl).read () thaum (True): _ counter = urllib.urlopen (myUrl).read () _ delta = int (counter) - int (last_counter) _ print "txee: %s, delta: % s " % (counter, delta) _ ser.write (chr (ord (chr (delta)))) _ last_counter = counter _ time.sleep (10) Kuv tsis tuaj yeem upload cov ntaub ntawv nrog php txuas ntxiv, yog li koj yuav tsum tau hloov lub npe counterphp.txt mus rau counter.php. Yog tias koj tus Arduino tseem txuas rau koj lub PC, tom qab ntawd pib Python tsab ntawv kom mus nqa koj tus lej ntaus…> nab hab sej counter.py thiab koj yuav tsum pom qhov tso tawm ntawm lub txee. Yog tias koj taw koj tus browser mus rau URL ntawm koj lub counter.php thiab ntaus rov qab, koj yuav tsum hnov koj lub suab hu nrov nrov. Yog, tam sim no peb tau ua tiav. Lub sijhawm rov qab los thiab txaus siab rau peb txoj haujlwm.
Kauj Ruam 6: Xaus
Nws yog thawj zaug, uas kuv tau tsim qee yam, uas tau txav chaw. Qhov ntawd yog thawj kauj ruam txhawm rau txhawm rau sib txawv ntawm lub ntiaj teb virtual thiab lub ntiaj teb tiag. Thiab nws tau yooj yim heev, cov cai yog ncaj nraim. Kuj feem ntau ntawm cov khoom nyob hauv kuv lub thoob khib nyiab, tsuas yog lub tswb. Muab txhua yam ua ke thiab tos kom ib tus neeg ntaus kuv qhov blog tau lom zem.
Vam tias koj nyiam nws.
Pom zoo:
Cov Duab Duab Duab thiab Cov Duab 1: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Cubes thiab Cov Duab 1: Thaum sim nrog qee cov ntoo ntoo thiab cov duab los qhia, kuv pom ob peb txoj hauv kev los ua cov voos thiab lwm yam duab los ntawm cov khoom siv yooj yim. Los ntawm kev muab cov no los ua Cov Ntawv Qhia, Kuv vam tias yuav txhawb nqa kev ua si thiab kev kawm. Kev hloov pauv ntawm qhov kev qhia no
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: Nov yog txoj hauv kev yooj yim heev thiab tus nqi qis mus rau cov duab thav duab digital - nrog qhov zoo ntawm kev ntxiv /tshem cov duab hla WiFi ntawm 'nyem thiab luag' siv (pub dawb) xa cov ntaub ntawv . Nws tuaj yeem siv tau los ntawm qhov me me £ 4.50 Pi Zero. Koj tseem tuaj yeem hloov pauv
Rov Qab Siv Cov Duab Duab Nrog Virtual Asistent: 7 Cov Kauj Ruam (nrog Duab)
Rov Qab Siv Cov Duab Duab Nrog Virtual Asistent: Nyob zoo txhua tus! Cov lus qhia no tau yug los ntawm lub laptop faib ua ib nrab, yuav los ntawm ib tus phooj ywg. Thawj qhov kev sim ntawm txoj haujlwm no yog kuv Lego Digital Photo Frame, txawm li cas los xij, yog ib tus neeg mob siab rau Siri thiab Google Tam sim no, Kuv txiav txim siab coj nws mus rau qhov tshiab
Tswj Cov Khoom Siv Los Ntawm Arduino Nrog Cov Neeg Siv Khoom Hloov: 8 Cov Kauj Ruam (nrog Duab)
Kev Tswj Cov Khoom Siv Los Ntawm Arduino Nrog Kev Siv Hluav Taws Xob: Lub Arduino tuaj yeem siv los tswj cov cuab yeej los ntawm kev siv cov khoom siv yooj yim hloov pauv hloov chaw
DIY Suab Nkauj Xmas Teeb rau Cov Pib Nrog Raspberry Pi: 12 Cov Kauj Ruam (nrog Duab)
DIY Suab Nkauj Xmas Teeb rau Cov Pib Nrog Raspberry Pi: Hnub no, Kuv yuav hla cov kauj ruam los siv raspberry pi kom tau txais koj lub teeb Christmas ci nrog suab paj nruag. Nrog tsuas yog qee qhov nyiaj ntawm cov khoom siv ntxiv, Kuv taug kev koj los ntawm kev hloov koj lub teeb Christmas tsis tu ncua mus rau hauv lub teeb pom kev zoo hauv tsev. Lub hom phiaj nws