Cov txheej txheem:
- Kauj Ruam 1: Yam Koj Xav Tau…
- Kauj Ruam 2: Txuas Cov Ntawv
- Kauj Ruam 3: Teeb Arduino IDE
- Kauj ruam 4: Sijhawm rau Code
Video: Qhov Ntsuas Kub Kub RGB (nrog XinaBox): 5 Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Nov yog qhov tseeb kuv thawj Cov Ntawv Qhia Qhia, yog li kuv yuav lees tias kuv siv lub sijhawm no tam sim no los sim nws. Tau txais kev xav ntawm yuav ua li cas lub platform ua haujlwm, tag nrho cov neeg siv tau ntsib ib sab ntawm nws. Tab sis thaum kuv ua qhov ntawd, Kuv xav tias kuv tseem tuaj yeem siv sijhawm los qhia txog txoj haujlwm yooj yim uas kuv tau ua haujlwm niaj hnub no (siv cov khoom lag luam los ntawm XinaBox, uas los ntawm txoj kev, tau hais tawm ua "X-in-a- Lub thawv ").
Hauv qhov yooj yim 5-qib qhia, kuv yuav hais txog cov ncauj lus hauv qab no:
- Cov khoom xav tau
- Txuas qhov sib txawv xChips ua ke.
- Teeb tsa Arduino IDE ib puag ncig.
- Sau cov cai
- Thiab thaum kawg, sim lub tswv yim tawm
Qhov kuv yuav tsis koom nrog hauv cov lus qhia no:
- Ntau npaum li kuv nyiam dhia hauv kev piav qhia txhua tus ntawm xChips tuaj yeem ua dab tsi thiab koj tuaj yeem siv lawv li cas los ua qee yam kev ua haujlwm, uas yuav tsis yog lub hom phiaj ntawm cov lus qhia no. Kuv npaj tshaj tawm lwm Cov Lus Qhia rau yav tom ntej uas yuav dhia mus rau txhua qhov sib txawv xChips uas muaj los ntawm XinaBox cov khoom lag luam.
- Kuv yuav tsis nkag mus rau qhov pib ntawm Arduino code raws li kuv xav tias koj twb muaj qee qib kev paub nrog siv Arduino IDE ntxiv rau kev nkag siab theem pib ntawm C/C ++ programming.
Kauj Ruam 1: Yam Koj Xav Tau…
Txuj ci, feem ntau cov khoom qhia yooj yim feem ntau pib nrog "Nyob Zoo Ntiaj Teb!" piv txwv, lossis txawm tias "Blink" piv txwv, uas koj yuav twb paub zoo heev txij li koj tau ua haujlwm nrog Arduino lossis Raspberry Pi ntawm qee kis. Tab sis kuv tsis xav pib nrog qhov ntawd vim txhua leej txhua tus twb tau ua ib yam nkaus, uas ua rau nws txaus siab me ntsis tiag tiag.
Hloov chaw, Kuv xav pib nrog lub tswv yim ua haujlwm. Ib yam uas yog ob qho yooj yim txaus thiab ua kom haum rau hauv cov phiaj xwm txoj haujlwm nyuaj dua yog tias koj xav tau.
Nov yog cov khoom uas peb yuav xav tau (xa mus rau cov duab muab rau ntu no ntawm Cov Lus Qhia):
- IP02 - Advanced USB Programming Interface
- CC03 - Caj npab Cortex M0+ Core
- SW02 - VOC thiab Huab Cua Huab Cua (uas siv BME680 sensor los ntawm BOSCH)
- xBUS cov khoom sib txuas - kom pab tau I2C kev sib txuas lus ntawm xChips sib txawv (x2)
- xPDI txuas - kom pab tau lub cajmeem thiab debugging (x1)
Kauj Ruam 2: Txuas Cov Ntawv
Txhawm rau txuas txhua daim ua ke, peb yuav xub pib nrog 1 daim ntawm xBUS txuas thiab xPDI txuas.
Ua raws li cov duab uas kuv tau muab, pom qhov kev taw qhia ntawm xChips thiab qhov txuas yuav mus qhov twg.
Nruab nrab ntawm IP02 & CC03 xChips, nws yooj yim heev los txheeb xyuas cov ntsiab lus sib txuas.
Rau CC03, nws yuav yog sab qab teb. Rau IP02, nws yuav yog sab qaum teb ntawm xChip.
Thaum qhov ntawd ua tiav, peb yuav ntxiv lwm qhov xBUS txuas rau sab hnub poob ntawm CC03 xChip.
Ua tiav?
Tam sim no, tsuas yog txuas SW02 xChip mus rau sab hnub poob ntawm CC03.
Ua ntej peb ntxig IP02 rau peb lub khoos phis tawj, xyuas kom meej tias cov kev xaiv hauv qab no tau xaiv rau ob qhov hloov pauv:
- B tau xaiv (sab laug hloov)
- DCE raug xaiv (txoj cai hloov)
Thaum kawg, tam sim no peb tau npaj los ntxig IP02 rau hauv peb lub laptop thiab pib teeb tsa Arduino IDE.
Kauj Ruam 3: Teeb Arduino IDE
Ib zaug ntxiv, hauv cov lus qhia no, Kuv tau ua qhov kev xav tias koj twb paub zoo txog Arduino IDE ib puag ncig nrog rau yuav ua li cas tswj cov tsev qiv ntawv nyob hauv ib puag ncig kev txhim kho.
Rau lub hom phiaj ntawm txoj haujlwm no, peb yuav xav tau ob lub tsev qiv ntawv tseem ceeb:
- arduino-CORE-https://github.com/xinabox/arduino-CORE
- SW02 lub tsev qiv ntawv -
Rub tawm ob lub tsev qiv ntawv mus rau qhov chaw nyob hauv koj lub desktop.
Tom ntej no, tso koj li Arduino IDE.
Los ntawm cov ntawv qhia zaub mov tseem ceeb, xaiv "Sketch"> "Include Library"> "Add. ZIP Library …"
Rov ua cov txheej txheem qub rau ob lub tsev qiv ntawv cov ntaub ntawv.
Tom ntej no, peb yuav tsum xaiv qhov cuam tshuam "Board" nrog rau "Port". (Daim ntawv ceeb toom tias kuv tseem tau hais qhia qhov kev xaiv tsim nyog siv lub thawv txiv kab ntxwv.
- Pawg thawj coj: "Arduino/Genuino Zero (Native USB Port)"
- Chaw nres nkoj: "COMXX" (qhov no yuav tsum yog raws li COM chaw nres nkoj uas tau cuam tshuam los ntawm koj lub tshuab. Kuv siv COM31)
Nyob zoo! Kuv paub koj tau mob siab rau dhia mus rau tus lej, yog li hauv qib tom ntej, qhov ntawd yog qhov peb yuav tsom mus rau.
Kauj ruam 4: Sijhawm rau Code
Hauv ntu no, Kuv yuav pib los ntawm kev sib qhia cov lej ntawm qhov ua tiav txoj haujlwm. Thiab thaum kawg, kuv yuav tshaj tawm tag nrho cov peev txheej, ua kom yooj yim rau koj kom yooj yim luam thiab muab cov lej tso rau hauv koj li Arduino IDE cov ntaub ntawv.
Cov Ntaub Ntawv Header:
#include /* Nov yog lub tsev qiv ntawv rau XinaBox Core Functions. */
#suav nrog /* Nov yog lub tsev qiv ntawv rau VOC & Huab Cua Sensor xChip. */
Txhais qee qhov tsis tu ncua rau kev tswj hwm RGB Led Teeb liab:
#define redLedPin A4
#define ntsuabLedPin 8 #define blueLedPin 9
Tom ntej no, peb yuav tsum tshaj tawm txoj haujlwm ua qauv rau dhau qhov RGB qhov tseem ceeb
void setRGBColor (int redValue, int greenValue, int blueValue);
Tshaj tawm cov khoom SW02:
xSW02 SW02;
Txoj kev teeb tsa () txheej txheem:
void teeb tsa () {
// Pib I2C Kev Sib Txuas Hlau.begin (); // Pib SW02 Sensor SW02.begin (); // Ncua rau lub ntsuas kom ua haujlwm qeeb (5000); }
Tam sim no rau lub ntsiab voj ():
void voj () {
ntab tempC; }
Tom ntej no, peb yuav tsum tau pov npav siv cov khoom SW02 uas peb tau tsim ua ntej hauv txoj haujlwm kom pib peb kev sib txuas lus nrog lub nti sensor:
// Nyeem thiab xam cov ntaub ntawv los ntawm SW02 sensorSW02.poll ();
Tam sim no, peb tab tom nyeem ntawv kom tau txais lub ntsuas qhov ntsuas kub
tempC = SW02.getTempC ();
Thaum peb tau nyeem, qhov kawg uas peb tab tom yuav ua yog siv ib qho ntawm yog tias … lwm yam … tswj cov lus los txiav txim siab qhov ntsuas kub, thiab tom qab ntawd hu rau setRGBColor () ua haujlwm
// Koj tuaj yeem hloov kho qhov kub thiab txias raws li koj qhov huab cua. Rau kuv, Kuv nyob hauv Singapore, // uas yog huab cua sov txhua xyoo puag ncig, thiab qhov kub thiab txias tuaj yeem nqaim ntawm no. yog (tempC> = 20 && tempC = 25 && tempC = 30 && tempC = 32 && tempC = 35) {setRGBColor (255, 0, 0); }
Nco tseg: Yog tias koj xav paub dab tsi cuam tshuam txog RGB qhov tseem ceeb rau cov xim tshwj xeeb, Kuv xav kom koj ua google tshawb rau "RGB xim qhov tseem ceeb". Muaj ntau qhov chaw muaj nyob qhov twg koj tuaj yeem siv tus xaiv xim xaiv cov xim uas koj xav tau
// Yog tias koj nyiam, thiab nws yog nyob ntawm yeem, koj tuaj yeem ntxiv qhov ncua sijhawm ntawm kev pov npav rau lub ntsuas qhov nyeem ntawv.
ncua (DELAY_TIME);
Koj tuaj yeem tshaj tawm qhov DELAY_TIME tas li thaum pib ntawm txoj haujlwm, txoj kev ntawd, koj tsuas yog yuav tsum hloov kho nws tus nqi ib zaug ntau dua li ntau qhov chaw thoob plaws hauv koj qhov program. Thaum kawg, peb xav tau txoj haujlwm los tswj peb RGB LED:
void setRGBColor (int redValue, int greenValue, int blueValue) {
analogWrite (redLedPin, redValue); analogWrite (ntsuabLedPin, ntsuabValue); analogWrite (blueLedPin, blueValue); }
Qhov Kev Kawm Kawg
#suav nrog
#suav nrog #define redLedPin A4 #define ntsuabLedPin 8 #define blueLedPin 9 tsis muaj teeb meem setRGBColor (int redValue, int greenValue, int blueValue); const int DELAY_TIME = 1000; xSW02 SW02; teeb tsa tsis muaj dab tsi () {// Pib I2C Kev Sib Txuas Hlau.begin (); // Pib SW02 Sensor SW02.begin (); // Ncua rau lub ntsuas kom ua haujlwm qeeb (5000); } void loop () {// Tsim kom muaj qhov sib txawv los khaws cov ntaub ntawv nyeem los ntawm SW02 ntab tempC; tempC = 0; // Nyeem thiab xam cov ntaub ntawv los ntawm SW02 sensor SW02.poll (); // Thov SW02 kom tau txais qhov ntsuas kub thiab khaws cia hauv // ntsuas kub sib txawv tempC = SW02.getTempC (); yog (tempC> = 20 && tempC = 25 && tempC = 30 && tempC = 32 && tempC = 35) {setRGBColor (255, 0, 0); } // Kev ncua me me ntawm lub sensor nyeem qeeb (DELAY_TIME); } void setRGBColor (int redValue, int greenValue, int blueValue) {analogWrite (redLedPin, redValue); analogWrite (ntsuabLedPin, ntsuabValue); analogWrite (blueLedPin, blueValue); }
Tam sim no tias peb txoj haujlwm tau npaj tiav, cia qhov program xChip! Cov txheej txheem Upload yog zoo ib yam li koj yuav tso qhov program rau koj li Arduino boards.
Thaum koj ua tiav, vim li cas ho tsis tshem nws thiab coj nws tawm rau qhov kev sim khiav.
Pom zoo:
Siv Smartphone Raws Li Tsis Siv Tus Kheej Ntsuas Kub / Tus Ntsuas Ntsuas Kub: 8 Kauj Ruam (nrog Duab)
Siv Smartphone Raws Li Tsis Siv Tus Kws Ntsuas Kub / Tus Ntsuas Kub Portable: Ntsuas lub cev kub nrog qhov tsis sib cuag / tsis sib cuag zoo li rab phom thermo. Kuv tsim txoj haujlwm no vim tias Thermo Gun tam sim no kim heev, yog li kuv yuav tsum tau txais lwm txoj hauv kev los ua DIY. Thiab lub hom phiaj yog ua nrog cov peev txheej qis .SuppliesMLX90614Ardu
ESP32 Raws M5Stack M5stick C Huab Cua Saib Nrog DHT11 - Saib Xyuas Qhov Kub Kub & Qhov Kub Kub ntawm M5stick-C Nrog DHT11: 6 Cov Kauj Ruam
ESP32 Raws M5Stack M5stick C Huab Cua Saib Nrog DHT11 | Saib Xyuas Qhov Kub thiab Qhov Ntsuas Kub ntawm M5stick-C Nrog DHT11: Nyob zoo cov neeg, hauv cov lus qhia no peb yuav kawm paub yuav ua li cas cuam tshuam DHT11 ntsuas kub nrog m5stick-C (pawg tswj hwm kev txhim kho los ntawm m5stack) thiab tso tawm ntawm cov zaub ntawm m5stick-C. Yog li hauv qhov kev qhia no peb yuav nyeem qhov ntsuas kub, av noo & heat kuv
ESP32 NTP Kev Ntsuas Kub Ua Haujlwm Kub Kub Nrog Steinhart-Hart Kho thiab Tswb Kub: 7 Kauj Ruam (nrog Duab)
ESP32 NTP Kev Ntsuas Kub Ua Haujlwm Ntsuas Kub nrog Steinhart-Hart Kev Kho thiab Tswb Kub: Tseem tab tom taug kev kom ua tiav "qhov haujlwm yuav los tom ntej", "ESP32 NTP Kev Ntsuas Kub Kev Ntsuas Kub Ua Noj Nrog Steinhart-Hart Kev Kho thiab Tswb Kub" yog Cov Ntawv Qhia qhia yuav ua li cas kuv ntxiv NTP ntsuas kub, piezo b
Ib Hnub Zoo Nkauj, Sijhawm thiab Qhov Ntsuas Kub Qhov Ntsuas: 3 Kauj Ruam
Ib Hnub Zoo Nkauj, Lub Sij Hawm thiab Qhov Ntsuas Kub: Nyob zoo cov phooj ywg, Hauv qhov kev qhia no, kuv yuav piav qhia cov txheej txheem rau hnub tim, sijhawm thiab ntsuas ntsuas ntsuas kub tam sim no los ntawm kev siv, Arduino pro mini, RTC thiab yim tus lej xya ntu ntu hauv chav tsev me me, uas yog ib qho txiaj ntsig devi
TECHNO VIKING! LED Horn ntawm Qhov Chaw Viking Kaus mom hlau: Qhov Ntsuas Qhov Ntsuas + Lub Hau Viking Transucent: 6 Kauj Ruam
TECHNO VIKING! LED Horn ntawm Qhov Chaw Viking Kaus mom hlau: Qhov Ntsuas Qhov Ntsuas + Lub Hau Viking Transucent: Yog! Nov yog lub kaus mom hlau rau Chaw Vikings. *** Hloov tshiab, Qhov no yuav tsum tau hloov pauv lub kaus mom hlau Techno Viking *** Tab sis nws lub Kaum Hli 2010 thiab kuv tsuas yog kawm txog Techno Viking hnub no. Zoo tom qab meme nkhaus. Whateva 'Ntawm no nws yog nrog cov khoom lag luam siab dua