Cov txheej txheem:
- Kauj Ruam 1: Qib Txuj Ci
- Kauj Ruam 2: Cov Cuab Yeej thiab Cov Cheeb Tsam
- Kauj Ruam 3: Kho Kho Lub Tshuab Virtual (khoos phis tawj) PART 1
- Kauj Ruam 4: Kho Kho Lub Tshuab Virtual (khoos phis tawj) PART 2
- Kauj Ruam 5: Kho lub Tshuab Virtual (khoos phis tawj) PART 3
- Kauj Ruam 6: Kho Kho Lub Tshuab Virtual (khoos phis tawj) PART 4
- Kauj Ruam 7: Nruab Web Server
- Kauj Ruam 8: Txhim Kho Qhov Web Application Framework
- Kauj Ruam 9: Npaj Software
- Kauj ruam 10: Undestanding Back-end Code thiab Ua Nws Ua Haujlwm
- Kauj Ruam 11: Kev nkag siab txog Txoj Cai Lij Choj-kawg thiab Ua Nws Ua Haujlwm PART 1
- Kauj Ruam 12: Nkag Siab Txog Txoj Cai Lij Choj-kawg thiab Ua Kom Nws Ua Haujlwm PART 2
- Kauj Ruam 13: Nkag Siab Txog Txoj Cai Pem Hauv Ntej thiab Ua Nws Ua Haujlwm PART 3
- Kauj Ruam 14: Kev nkag siab txog Txoj Cai Lij Choj-kawg thiab Ua Nws Ua Haujlwm PART 4
- Kauj ruam 15: Arduino Code
- Kauj Ruam 16: RGB LED Chain
- Kauj Ruam 17: Kho kom zoo nkauj tsob ntoo Christmas
- Kauj Ruam 18: Kov Kawg
- Kauj Ruam 19: Qhuas Koj Lub Vev Xaib
Video: Lub Vev Xaib-Tsob Ntoo Christmas Tsob Ntoo (Ib Tus Neeg Tuaj Yeem Tau Nws): 19 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:24
Koj puas xav paub lub vev xaib tswj hwm tsob ntoo Christmas zoo li cas?
Nov yog daim vis dis aus qhia tawm kuv qhov project ntawm kuv tsob ntoo Christmas. Tam sim no cov kwj tawm tau xaus los txog tam sim no, tab sis kuv tau ua video, ntes dab tsi tau tshwm sim:
Xyoo no, nyob rau nruab nrab Lub Kaum Ob Hlis, Kuv tau pw hauv kuv lub txaj, sim pw hauv nruab nrab ntawm ib lub lim tiam ua haujlwm. Thiab tsis txhob tsaug zog kuv tau xav txog dab tsi yuav yog lub caij Christmas txias uas yuav ua. Thiab tom qab ntawd lub tswv yim txias tau ntaus kuv.
Raws li kuv tub nkeeg nrog kho kom zoo nkauj Christmas, nws yuav txias cia rau lwm tus tswj kuv lub teeb Christmas, yog li kuv yuav tsis muaj kev txhawj xeeb txog nws.
"Yuav ua li cas yog tias kuv ua tsob ntoo Christmas teeb uas txhua tus tuaj yeem tuaj yeem tswj tau los ntawm lub vev xaib sib tham?"
(ntxig ob lub lis piam ntawm kev pw tsaug zog hmo ntuj)
Yog li kuv ua nws.
Ib tsob ntoo Christmas nrog nees nkaum RGB LEDs txuas nrog internet ntawm ESP8266 Arduino.
Ib tus phooj ywg ntawm kuv (ua tsaug rau JP) tau pab kuv teeb tsa lub vev xaib (txij li kuv tsis yog tus kws tshaj lij hais lus rau lub vev xaib ntsig txog cov khoom).
Thiab peb teeb tsa 24/7 youtube nyob ntawm kuv tsob ntoo yog li koj yuav tuaj yeem pom qhov koj tab tom qhib lossis kaw txhua lub sijhawm.
Txoj haujlwm no zoo tshaj rau xyoo no, txij li peb coob leej raug kaw, tsis tuaj yeem ntsib thiab sib tham nrog phooj ywg thiab tsev neeg. Vim li cas ho tsis koom ua ke ntawm tsob ntoo Christmas:)
Hauv Cov Lus Qhia Kuv yuav piav qhia ntxaws txog qhov project no tau ua li cas.
Kauj Ruam 1: Qib Txuj Ci
Txoj haujlwm no yog software ntau dua. Tab sis tsis txhob ntshai Qee qhov hmoov zoo thiab kev pab ntawm txiv ntxawm Google yuav pab loj heev:)
Koj yuav tsum muaj teeb tsa ntawm 3 qhov txuj ci (lossis koj yuav kawm tsis muaj kev txhawj xeeb): lub vev xaib ib feem, Arduino ib feem thiab tsob ntoo Christmas tau kawg!
Pom zoo paub:
• Muaj txuj ci computer thiab tsim txuj ci
• Kev paub Linux davhlau ya nyob twg paub
• Kev paub siv computer yooj yim
• Kev paub txog hluav taws xob yooj yim
• Kev txawj siv Google thiab lwm yam peev txheej "tshwj xeeb"
• Yuav tsum paub teeb tsa tsob ntoo Christmas:)
Yog tias koj muaj qee qhov kev nkag siab ntawm thev naus laus zis thiab kev ua haujlwm koj yuav tsum muaj peev xwm kawm los teeb tsa qhov no raws li Cov Lus Qhia no.
Kauj Ruam 2: Cov Cuab Yeej thiab Cov Cheeb Tsam
Ntawm tsob ntoo Christmas, koj yuav xav tau: • Ntoo Christmas (d'oh…)
• A NodeMCU micro-controller board
(koj tseem tuaj yeem siv ESP32 lossis lwm yam Wi-nkaus lossis Ethernet cov laug cam muaj peev xwm)
• Chaw nyob RGB LED sawb. addressable RGB coj sawb yuav txuag ntau Arduino GPIOs (https://www.sparkfun.com/products/11020)
• Software rau NodeMCU (muab hauv phau ntawv qhia no)
Ntawm server sab koj yuav xav tau:
• Tus neeg rau zaub mov ntiag tug virtual nrog tus IP pej xeem. Ntawm no koj tau txais $ 100 dawb ntawm DigitalOcean
• Ib tus sau (xaiv tau) koj tuaj yeem sau npe ntawm ib lub koom haum sau npe, piv txwv li
• Dedicated Code (muab nrog Cov Lus Qhia no)
Kauj Ruam 3: Kho Kho Lub Tshuab Virtual (khoos phis tawj) PART 1
Cia peb mus ncaj rau coding:)
Peb xav tau tus neeg rau zaub mov, uas yuav sib tham nrog lub vev xaib thiab NodeMCU.
Cov neeg ua haujlwm ntawm DigitalOcean tso cai rau peb kom muaj lub tshuab virtual nrog tus IP chaw nyob, uas txhais tau tias, peb tuaj yeem ua haujlwm pabcuam rau nws, thiab nkag mus tau thoob ntiaj teb.
Thaum koj them nyiaj DigitalOcean txhua lub hlis (koj tuaj yeem siv 60 hnub sim dawb), tsim ib qhov haujlwm thiab npe nws tsob ntoo Christmas lossis txhua yam koj xav tau.
Tam sim no koj tuaj yeem tsim koj lub tshuab virtual (lub khoos phis tawj virtual nkag tau yooj yim) los ntawm txhaj "Pib nrog lub qhov me me" (uas yog DigitalOcean lub npe rau lub tshuab virtual).
Ib nplooj ntawv teeb tsa yuav los txog thiab koj tuaj yeem nyob nrog lub neej ntawd: Ubuntu duab, phiaj xwm yooj yim thiab tsis muaj qhov thaiv cia (5 $ /hli)
Kauj Ruam 4: Kho Kho Lub Tshuab Virtual (khoos phis tawj) PART 2
Ib cheeb tsam datacenter yog qhov chaw uas koj lub server yuav tsim.
Xaiv qhov ze tshaj plaws rau koj thiab koj cov neeg siv khoom muaj peev xwm. Qhov no yuav muab sijhawm teb qis tshaj.
Ntxiv mus, hauv ntu Kev Pov Thawj, koj yuav raug nug kom nkag mus tus lej nkag mus nkag rau koj lub tshuab virtual.
Hauv qhov ua tiav thiab tsim ntu, khaws qhov ua tsis tiav ntawm 1 lub qhov me me, xaiv lub npe host (Christmas tsob ntoo dua), xaiv koj txoj haujlwm tsim yav dhau los yog tias tsis tau xaiv los ntawm lub neej ntawd thiab nyem Tsim cov dej. Qhov no yuav siv ob peb feeb. Los ntawm txhaj rau koj txoj haujlwm hauv ntu kev taw qhia ntawm sab laug koj yuav pom koj cov tee dej.
Kauj Ruam 5: Kho lub Tshuab Virtual (khoos phis tawj) PART 3
Los ntawm kev nyem rau ntawm peb tus lej ntawm sab xis ntawm lub qhov dej koj tuaj yeem nyem Access console, uas yuav ua rau koj nkag mus rau koj lub khoos phis tawj virtual.
Qhov tshiab browser qhov rai me me yuav qhib. Tam sim no, qhov no tsis yog lub desktop ib puag ncig, zoo li ntawm koj Windows 10 lossis Ubuntu nrog Graphical interface computer.
Txawm li cas los xij, txhua yam tuaj yeem ua tiav ntawm lub console interface.
Nws tsis txaus ntshai li nws zoo li:)
Kauj Ruam 6: Kho Kho Lub Tshuab Virtual (khoos phis tawj) PART 4
Koj tau ua tiav tsim koj tus kheej lub tshuab virtual hauv DigitalOcean huab.
Hauv cov kauj ruam tom ntej, koj yuav teeb tsa lub web server, hu ua Apache thiab teeb tsa koj tus kheej lub vev xaib.
Rub tawm Filezilla tus thov kev pabcuam ntawm no https://filezilla-project.org/download.php?platfo… (lossis nrhiav 32bit version rau 32bit operating system) thiab nruab nws. Nws yog FTP (Cov Ntaub Ntawv Hloov Cov Txheej Txheem) cov neeg siv khoom.
Koj yuav tuaj yeem nkag mus thiab hloov cov ntaub ntawv los ntawm thiab rau koj lub tshuab virtual.
Thaum tau teeb tsa, nyem cov ntaub ntawv → tus thawj tswj chaw site qhov chaw tshiab thiab sau cov ntaub ntawv zoo li ntawm daim duab saum toj no.
Raws tu qauv: SFTP (Cov Ntaub Ntawv Ruaj Ntseg Hloov Ntaub Ntawv)
Tus tswv tsev: IP ntawm koj lub server, nrhiav hauv koj qhov DigitalOcean project.
Tus neeg siv lub hauv paus thiab tus password yog qhov koj teeb tsa nws ntawm kev tsim koj cov dej.
Nyem OK thiab txuas rau koj lub tshuab virtual.
Koj yuav raug ceeb toom, tus tswv tseem ceeb tsis paub. Ua raws li daim duab thib ob.
Tsim lub nplaub tshev hauv zos rau txoj haujlwm, thiab rho tawm koj cov ntaub ntawv phiaj xwm koj yuav rub tawm ntawm no.
Koj yuav kho koj cov ntaub ntawv ntawm koj lub computer thiab xa lawv mus rau koj lub tshuab virtual txhua lub sijhawm koj xav sim lossis hloov kho cov cai.
Kauj Ruam 7: Nruab Web Server
Nkag mus rau koj lub droplet console nrog lub npe siv hauv paus thiab koj tus password.
Raws li peb tsis muaj lub graphical interface, peb siv cov lus txib los tswj koj lub tshuab virtual. Nov yog qee cov lus txib uas koj yuav siv ntawm Ubuntu (Linux):
• pwd - luam kuv phau ntawv teev npe tam sim no
• ls - teev cov ntaub ntawv thiab cov ntawv tais ceev tseg hauv kuv phau ntawv teev npe tam sim no
• cd / - txav mus rau / npe (ntawv tais ceev tseg, uas suav nrog linux cov npe loj xws li thiab lwm yam, rau hauv, khau raj, dev, hauv paus, tsev, var thiab ntxiv rau)
Los ntawm kev khiav, kuv txhais tau tias, nkag mus rau cov lus txib thiab nias nkag mus.
Tam sim no, peb yuav khiav apt -tau hloov tshiab -y txhawm rau hloov kho qhov system.
Khiav apt nruab apache2 -y rau nruab Apache web server.
Koj lub vijtsam zoo siab tos txais Apache yuav tsum nkag tau ntawm koj li https:// virtual-machine-ip los ntawm koj tus browser.
Hloov virtual-tshuab-ip nrog koj lub tshuab virtual ip, piv txwv li 165.12.45.123. Koj tseem tuaj yeem hla https:// raws li nws yuav raug txiav ntxiv.
Nrog koj zoo siab!
Nco tseg:
Yog tias koj xav kom koj lub vev xaib nkag tau los ntawm lub npe, tsis yog IP chaw nyob (zoo li kuv tau siv https://blinkmytree.live/), mus rau tus muab kev pabcuam site GoDaddy lossis zoo sib xws (namecheap.com thiab lwm yam..) thiab ua raws cov lus qhia ntawm no:
Qee lub npe sau yog pheej yig heev. Kuv qhov sau tau raug nqi tsuas yog 2 $ toj xyoo. Yeej tsim nyog tau nyiaj:)
Kauj Ruam 8: Txhim Kho Qhov Web Application Framework
Rov qab mus rau peb lub console. Tsis txhob ntshai:)
Siv Filezilla los tsim daim nplaub tshev npe app hauv /tsev, yog li /tsev /app yuav yog koj li ntawv
Khiav cd /home /app mus rau sab hauv app nplaub tshev.
Khiav apt nruab npm -y, rau installl npm tus thawj tswj pob. Qhov no yuav siv ob peb feeb.
Khiav npm init -y los tsim cov ntaub ntawv pob.json, uas yuav taug qab/nco qab pob loj cov ntaub ntawv hais txog ib qho app.
Khiav npm -txuag teeb tsa cors nthuav qhia rau nruab modules cors, nthuav tawm
Cors yog tus qauv rau teeb tsa kev nkag mus rau qhov chaw hla thiab nthuav tawm yog lub vev xaib daim ntawv thov.
Npm yog tus tswj hwm pob peb siv thiab peb yuav siv node.js JavaScript runtime los ua haujlwm rau peb cov ntawv thov kev sib txuas lus (API), uas yuav, ua ke nrog http server, lees txais HTTP thov rau thov xim rau LEDs, cim lawv qhov tseem ceeb (xim) hauv kev nco, thiab dhau qhov txiaj ntsig rau NodeMcu, thaum nws thov nws.
Nco tseg: Node hauv NodeMcu tsis muaj dab tsi ua nrog ntawm node.js. NodeMcu tuaj yeem hloov pauv nrog ib qho internet txuas nrog arduino pawg thawj coj txhim kho, NXP pawg thawj coj loj, lossis kev cai Microchip/NXP/Renesas/STM/Atmel PCB. Node.js kuj tseem tuaj yeem hloov nrog. Net moj khaum, PHP lossis lwm lub platform. Tab sis kom yooj yim, peb siv NodeMCU thiab Node.js.
Tam sim no, cia ua qhov kev sim, yog tias peb tuaj yeem ua haujlwm me me hauv node.js
Tsim cov ntaub ntawv npe index.js nrog notepad/notepad ++ lossis lwm tus kws kho mob lossis kev txhim kho ib puag ncig ib puag ncig koj siv (Visual Studio Code https://code.visualstudio.com/) hauv koj lub zos nplaub tshev.
Muab cov cai no tso rau hauv:
var http = xav tau ('http');
http.createServer (muaj nuj nqi (req, res) {
res.writeHead (200, {'Cov ntsiab lus-hom': 'ntawv nyeem/dawb'});
res.end ('Nyob Zoo Ntiaj Teb!');)) mloog (8080);
Txuag nws thiab hloov nws mus rau nplaub tshev/tsev/app raws li index.js nrog ob npaug nias/rub-nco ntawm cov ntawv hauv FileZilla.
Khiav ntawm qhov index.js, thiab cia nws khiav.
Tam sim no, peb tuaj yeem nkag mus rau peb nplooj ntawv ntawm https:// virtual-machine-ip: 8080 los ntawm peb tus browser. Ib nplooj ntawv dawb nrog Hello World text yuav tshwm sim.
Nrog koj zoo siab, koj nyuam qhuav tsim lub web server hauv node.js!
Kauj Ruam 9: Npaj Software
Mus rau console thiab nres qhov haujlwm los ntawm nias ctrl+C.
Hloov koj cov ntawv index.js hauv/home/app/thiab hloov nws nrog peb index.js hauv.
Koj tuaj yeem rub tawm txhua cov ntaub ntawv rau lub vev xaib ntawm no:
drive.google.com/file/d/1oIFdipoJxg6PF5klO…
Luam peb Chrismas tsob ntoo code los ntawm html nplaub tshev rau cov npe nyob deb/var/www/html/nrog Filezilla. Nws yuav siv sijhawm me ntsis. Yog nws nug koj, hloov index.html nrog tus tshiab.
Muab koj tus IP rov qab rau hauv koj lub vev xaib nyiam.
Koj nyuam qhuav ua koj lub vev xaib thov ua ntej-kawg muaj nyob ntawm https:// virtual-machine-ip.
Kauj ruam 10: Undestanding Back-end Code thiab Ua Nws Ua Haujlwm
Nco tseg: koj tus lej rov qab kawg yog nyob ntawm /home /app
Nco ntsoov, tom qab koj kho koj cov cai hauv ib cheeb tsam, tsis txhob hnov qab upload nws rau koj lub server siv FileZilla, thiab rov pib dua koj daim ntawv thov (console: ctrl+c, xub nce (qhia qhov kawg hais kom ua node index.js), nkag mus)
Txhawm rau ua haujlwm, koj yuav tsum nkag mus ob peb cov ntaub ntawv ua ntej.
Ua ntej, koj yuav tsum hloov pauv hostname sib txawv hauv index.js rau koj tus kheej lossis IP, (qee yam uas zoo li: 165.13.45.123).
Qhov thib ob, Kuv yuav coj koj hla txoj cai kom nkag siab nws. Nco ntsoov tsis txhob hla cov lus kuv tau ua hauv cov cai.
Koj tuaj yeem pom hauv cov ntawv index.js, uas peb tsim ib qho app siv cov qauv qhia. Tom qab ntawd, peb siv CORS cov cai rau nws, ntxiv APIs thiab pib http server. Tus neeg rau zaub mov no yuav tsis ua haujlwm web-nplooj dhau GET http thov, tab sis nws yuav ua haujlwm rau cov xeev coj los ntawm GET http thov thiab hloov kho cov xeev ntawm tau txais PUT http thov.
APIs yog ib txwm coj los pauv cov ntaub ntawv ntawm cov ntawv thov. Feem ntau peb siv yog REST APIs peb siv peb tus kheej. Lawv yog neeg tsis muaj tebchaws thiab tsis muaj kev txuas mus txuas ntxiv (shorturl.at/aoBC3, PUT thov yooj yim hloov kho cov xeev coj hauv app array sib txawv (nco), Tau txais kev thov yooj yim xa cov xeev coj mus rau tus neeg siv khoom.
Cov lus teb rau tus neeg siv khoom feem ntau yog hauv JSON qhov cim tseg, tab sis rau qhov lus teb yooj yim ntawm 30 LED xeev, peb tsuas xa txoj hlua ntawm 30 tus lej cais cais qhov tseem ceeb.
Kauj Ruam 11: Kev nkag siab txog Txoj Cai Lij Choj-kawg thiab Ua Nws Ua Haujlwm PART 1
Nco tseg: koj tus lej ua ntej-kawg yog nyob ntawm/var/www/html
Nco ntsoov, tom qab koj kho koj tus lej hauv zos, tsis txhob hnov qab xa nws mus rau koj lub server siv FileZilla. Tsis zoo li node.js, Apache rov pib dua nws tus kheej, tab sis koj yuav tsum rov qhib koj nplooj ntawv hauv koj tus browser. Siv ctrl+f5 txhawm rau kho tshiab thiab tshem tawm cov cache ntawm koj nplooj ntawv thiab.
Txhawm rau ua haujlwm, koj yuav tsum tau sau ob peb cov ntaub ntawv. Ua ntej, koj yuav tsum hloov qhov url sib txawv hauv xa_requestus muaj nuj nqi hauv index.html los ntawm blinkmytree.live rau koj tus kheej sau lossis IP, piv txwv: 165.13.45.123.
Qhov thib ob, Kuv yuav coj koj hla txoj cai kom nkag siab nws. Nco ntsoov tsis txhob hla cov lus kuv tau ua hauv cov cai. Nplooj ntawv yog cov ntawv HTML. Tawm ntawm txhua txoj cai CSS (nplooj ntawv style thiab cov ntsiab lus txoj haujlwm) ib sab, peb yuav saib xyuas cov haujlwm tseem ceeb. Xav paub ntau ntxiv txog CSS, txheeb xyuas
Peb xav tau cov yam ntxwv tseem ceeb no (cov kws tshaj lij ntawm txoj kev nrawm yuav hais cov neeg siv dab neeg) ntawm nplooj ntawv:
• Nyob yees duab kos rau hauv nplooj ntawv
• Ib qho nyem LEDs ntawm tsob ntoo christmas, uas tau siv hauv Gimp duab editor (https://www.gimp.org/).
• Kev sib txuas lus tiag tiag nrog tus neeg rau zaub mov, tos kom hloov pauv cov xeev.
Kauj Ruam 12: Nkag Siab Txog Txoj Cai Lij Choj-kawg thiab Ua Kom Nws Ua Haujlwm PART 2
Thaum peb muaj peb tsob ntoo Christmas nrog cov lej ntawm LEDs thiab xim xaiv, peb yuav tsum tsim thaj chaw thiab siv cov kev coj ua rau lawv, yog li ib zaug peb nyem rau ntawm cov xim LED nyob hauv ntu xaiv ntawm cov duab, xim yuav raug xaiv, thiab ib qho peb nyem rau ntawm LED, cov lus txib yuav xa mus rau tus neeg rau zaub mov, qhov twg Arduino yuav xaiv nws tus nqi.
Hauv HTML5, tus qauv HTML tshiab tshaj plaws, muaj qee yam hu ua daim duab qhia chaw. Nws tso cai rau peb los txheeb xyuas thaj tsam ntawm daim duab, uas peb tuaj yeem siv cov neeg mloog ua rau nws.
Raws li peb muaj ntau thaj tsam los txhais, peb siv cov cuab yeej online https://www.image-map.net/ txhawm rau txheeb xyuas cov cheeb tsam no thiab theej cov lej HTML rau peb nplooj ntawv.
Thaum peb ua qhov ntawd, peb tuaj yeem tso cov xwm txheej onclick nrog lub luag haujlwm nws hu thiab ntsuas ntawm tus lej LED rau txhua ntawm cov cheeb tsam no. Saib qhov screenshot saum toj no.
Kauj Ruam 13: Nkag Siab Txog Txoj Cai Pem Hauv Ntej thiab Ua Nws Ua Haujlwm PART 3
Sab hauv qhov kawg ntawm HTML lub cev, hauv ib cheeb tsam, peb tso qee qhov JavaScript, txhawm rau txheeb xyuas cov haujlwm peb hu hauv onclick cov xwm txheej. Thoob plaws ntiaj teb, peb txhais XMLHttpRequest, uas peb siv los xa PUT thov
Peb muaj ob txoj haujlwm:
muaj nuj nqi set_color (val)
muaj nuj nqi send_request (id)
Txog kev xeem API thov, Kuv pom zoo siv feem ntau siv software hu ua Postman https://www.postman.com/. Nws tso cai rau peb kom yooj yim xa API thov mus rau tus neeg rau zaub mov, yam tsis muaj kev txawj sau ntawv. Nws tso cai rau thuam tus neeg rau zaub mov, thiab lees txais kev thov ib yam nkaus.
Kauj Ruam 14: Kev nkag siab txog Txoj Cai Lij Choj-kawg thiab Ua Nws Ua Haujlwm PART 4
Koj daim ntawv thov ua haujlwm.
Ceev faj, cov lej tau thim rov qab, uas yog, 20 yog 1 thiab 1 yog 20, qhov no yog vim tias LEDs ntawm tsob ntoo pib hauv qab, tab sis rau kev paub siv tau zoo dua, peb tso qhov pib coj mus rau saum.
Koj tseem yuav xav tsim cov kwj tawm hauv YouTube yog tias koj xav tau, thiab hloov cov lej cim ntawm YouTube video nrog koj tus kheej.
Kauj ruam 15: Arduino Code
ESP8266 sau tus lej HTTP Client piv txwv piv txwv uas tau hloov kho me ntsis, tau txais cov ntaub ntawv los ntawm kuv lub vev xaib ntawm API hu.
Koj kuj tseem yuav tsum teeb tsa lub tsev qiv ntawv rau kev tswj hwm cov kab hluav taws xob LED yog tias koj xav siv tib qhov chaw nyob RGB sawb ib yam li kuv tau ua.
github.com/adafruit/Adafruit-WS2801-Librar…
Hauv daim duab kuv tau txuas nrog, koj yuav tsum tau ntxig koj lub npe wi-fi thiab tus password rau qhov url rau koj lub vev xaib (saib cov lus pom)
Peb pib hloov http cov lus teb rau hauv C-ntaus txoj hlua, yog li peb tuaj yeem siv C ua haujlwm strtok txhawm rau cais cov hlua los ntawm tus lej thiab sau cov lus leds nrog cov txiaj ntsig nyeem los ntawm server. Dua li peb hu ua lub luag haujlwm uas peb hla lub rooj, thiab raws li qhov muaj txiaj ntsig, peb tig cov xim raug rau tus neeg siv xav tau.
Qhov ntawd yog nws!
Nrog koj zoo siab, koj ua tau!
Kauj Ruam 16: RGB LED Chain
Ua, oh. Tam sim no nws yog lub sijhawm los so me ntsis ntawm txhua qhov coding:)
Txij li ESP8266 tsis muaj ntau GPIO tus pin los tswj LEDs ib tus zuj zus, Kuv tau siv qhov chaw nyob RGB LED saw:
www.sparkfun.com/products/11020
Txoj kev no, tag nrho 20 RGB leds (60 leds tag nrho) tuaj yeem tswj tau los ntawm tsuas yog ob tus pin - "cov ntaub ntawv" thiab "moos" thiab 5V lub zog ncaj qha los ntawm ESP8266.
Txuas cov kab txaij mus rau NodeMcu yog qhov yooj yim. 5V rau Vin ntawm NodeMcu (5V los ntawm USB), xaim daj rau tus pin 12, ntsuab xaim rau tus pin 14, hauv av rau hauv av.
Koj tuaj yeem teeb tus kheej RGB xim, thiab ci ntsa iab. Nrog qee qhov sib xyaw xim, koj tuaj yeem tsim ntau xim rau txhua LED.
Kuj tseem muaj lub tsev qiv ntawv txias heev rau txhua hom txias FX cuam tshuam nrog cov LEDs no. Sim nws yog tias koj nyiam:
github.com/r41d/WS2801FX
Kauj Ruam 17: Kho kom zoo nkauj tsob ntoo Christmas
Ua kom nws zoo nkauj thiab ua kom ntseeg tau tias txhua lub LED tau pom thiab zoo kis thoob tsob ntoo.
Kauj Ruam 18: Kov Kawg
Thaum koj tau npaj tsob ntoo, yees duab zoo nkauj thiab rov ua cov kauj ruam rau kev tsim daim duab qhia chaw ntawm cov haujlwm uas nyem tau (LED txoj haujlwm)
Qhov no yog txoj hauv kev zoo tshaj plaws ntawm kev cuam tshuam nrog LEDs.
Yog tias koj tsis xav kom cov khoom sib tshooj ntau, koj tuaj yeem siv cov nyees khawm ib txwm ua.
Koj kuj yuav tsum pib ua cov dej ntws ntawm koj tsob ntoo hauv YouTube (yog tias koj xav saib dab tsi tshwm sim hauv lub sijhawm tiag tiag) thiab teeb tsa cov kwj rau hauv koj lub xaib.
Kauj Ruam 19: Qhuas Koj Lub Vev Xaib
Koj zoo heev yog tias koj ua tau qhov no deb:) caw koj cov phooj ywg (thiab kuv tau kawg: P) thiab ua rau lawv nyem koj tsob ntoo kom ntau li ntau tau:)
n
Qhov no yog lus qhia ntev heev, rau txoj haujlwm nyuaj. Tab sis nws tsim nyog nws thaum kawg: D
Ua tsaug! Yog tias koj xav nyob hauv kev sib cuag ntawm qhov kuv tab tom ua haujlwm:
Koj tuaj yeem sau npe yuav rau kuv tus YouTube channel:
www.youtube.com/c/JTMakesIt
Koj tseem tuaj yeem ua raws kuv ntawm Facebook thiab Instagram
www.facebook.com/JTMakesIt
www.instagram.com/jt_makes_it nws
rau spoilers ntawm qhov kuv tab tom ua haujlwm tam sim no, tom qab qhov xwm txheej thiab lwm yam ntxiv! PS:., Yog tias koj tiag tiag, tiag tiag nyiam nws, koj tseem tuaj yeem yuav kuv kas fes ntawm no, yog li kuv yuav muaj lub zog ntxiv rau cov phiaj xwm yav tom ntej (qhov no tau siv 2 lub lis piam pw ntawm kuv, vim kuv tau txais lub tswv yim no lig dhau lawm):)
www.buymeacoffee.com/JTMakesIt
Thiab tsis txhob hnov qab pov npav rau Cov Lus Qhia hauv "Txhua Yam Mus" kev sib tw:)
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
Ntoo RC Nkoj Uas Koj Tuaj yeem Tswj Tus Kheej lossis Via Lub Vev Xaib: 9 Kauj Ruam
Ntoo RC Nkoj Uas Koj Tuaj yeem Tswj Tus Kheej lossis Via Lub Vev Xaib: Nyob zoo Kuv yog menyuam kawm ntawv ntawm Howest thiab kuv tau tsim Ntoo Ntoo nkoj uas koj tuaj yeem tswj tau ntawm tus tswj lossis ntawm lub vev xaib. thiab kuv xav tau qee yam kom txaus siab rau kuv tus kheej thaum kuv nyob ntawm hiav txwv
ARUPI - Tus Nqi Tus Nqi Tus Nqi Uas Tau Txais Tus Nqi Uas Tau Txais Tus Nqi/Tus Kheej Tus Kheej (ARU) rau Soundscape Ecologists: 8 Kauj Ruam (nrog Duab)
ARUPI - Tus Nqi Tus Nqi Uas Tau Txais Tus Nqi Tus Nqi Uas Tau Txais Tus Nqi/Tus Kheej Tus Kheej (ARU) rau Soundscape Ecologists: Cov lus qhia no tau sau los ntawm Anthony Turner. Txoj haujlwm tau tsim los nrog ntau qhov kev pab los ntawm Shed hauv Tsev Kawm Ntawv ntawm Kev Suav, University of Kent (Mr Daniel Knox tau pab zoo!)
Yuav Ua Li Cas Tau Txais Cov Nkauj Los Ntawm Txhua Qhov (Haha) Lub Vev Xaib (Ntev Li Koj Tau hnov Nws Koj Yuav Tau Txais Nws Ok Zoo Yog Nws Tau Ntxig Hauv Flash Koj Yuav Tsis Muaj Peev Xwm) EDITED !!!!! Ntxiv Info: 4 Cov Kauj Ruam
Yuav Ua Li Cas Tau Txais Cov Nkauj Los Ntawm Txhua Qhov (Haha) Lub Vev Xaib (Ntev Li Koj Tau hnov Nws Koj Yuav Tau Txais Nws … Ok Zoo Yog Nws Tau Ntxig Hauv Flash Koj Yuav Tsis Muaj Peev Xwm) EDITED !!!!! Ntxiv Cov Lus Qhia: yog tias koj tau mus rau lub vev xaib thiab nws ua nkauj nkauj uas koj nyiam thiab xav tau nws ntawm no yog cov lus qhia rau koj tsis yog kuv qhov txhaum yog tias koj cuam tshuam qee yam (tsuas yog txoj hauv kev nws yuav tshwm sim yog tias koj pib tshem cov khoom yam tsis muaj laj thawj. ) Kuv tuaj yeem tau txais cov nkauj rau
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