Cov txheej txheem:
- Kauj Ruam 1: Yam Koj Xav Tau thiab Schematic
- Kauj Ruam 2: Arduino Code Tshaj Tawm thiab teeb tsa
- Kauj Ruam 3: Arduino Code (Txoj Cai Tseem Ceeb)
- Kauj ruam 4: App Inventor
- Kauj ruam 5: Kev sib cav
Video: Arduino Led/Strips RGB Bluetooth (Arduino + App Inventor): 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:28
Hauv qhov kev qhia no kuv yuav qhia siv App Inventor thiab txuas nws nrog arduino siv bluetooth
Kauj Ruam 1: Yam Koj Xav Tau thiab Schematic
Zoo qhov no yog cov npe raws li usuall tsis muaj dab tsi hloov pauv yog tias koj nyob ntawm no rau tsab ntawv tsuas yog scroll nws
- Kev sib txuas hauv internet
- Xov tooj Android (tau kawg)
- Sau npe nws dawb (tsis nce qib) App Inventor
- Arduino + Bluetooth module
- LED/Sawb RGB
- Resistor 100/200/330
Kauj Ruam 2: Arduino Code Tshaj Tawm thiab teeb tsa
Ua ntej tshaj tawm qhov hloov pauv, tus lej chaw nres nkoj, thiab lwm yam (Hloov "nrog <)
#suav nrog "SoftwareSerial.h"
#suav nrog "Wire.h" SoftwareSerial BT (10, 11);
Kuv tab tom siv chaw nres nkoj 7 thiab 8 ua RX TX, nco ntsoov yog tias koj xav txuas lub bluetooth module kom ntseeg tau tus pin RX module txuas rau tus pin TX.
int LED_RED = 3;
int LED_GREEN = 5; int LED_BLUE = 6; Txoj hlua cov ntaub ntawv = ""; Txoj hlua data_Previous = "255.255.255"; Txoj hlua ON = "LON"; Txoj hlua OFF = "LOFF"; boolean state = cuav;
tsab ntawv tom ntej yog kom paub tseeb tias tus pin ntawm RGB LED/Stips mus rau tus pin PWM
void teeb tsa ()
{pinMode (LED_RED, OUTPUT); pinMode (LED_GREEN, pinMode (LED_BLUE, OUTPUT); Serial.begin (9600); BT.begin (9600); data.reserve (30);}
Raws li koj tuaj yeem pom kuv lub npe chaw nres nkoj rau bluetooth li BT yog li tshaj tawm nws zoo li Serial li qub, nco ntsoov tias lub suab nrov zoo ib yam li kev teeb tsa ntawm tus qauv (lub neej ntawd yog 9600).
Kauj Ruam 3: Arduino Code (Txoj Cai Tseem Ceeb)
INSIDE VOID LOOP
thaum (BT.available ())
{char ReadChar = (char) BT.read (); Serial.println ("Txuas"); yog (ReadChar == '+') {xeev = tseeb; } lwm {data += ReadChar; }}
Tsab ntawv rau tshuaj xyuas lub bluetooth module txuas lossis tsis tau, yog txuas nrog nws yuav tau txais cov ntaub ntawv thiab khaws nws rau ReadChar.
yog (xeev)
{Serial.print ("cov ntaub ntawv:"); Serial.print (cov ntaub ntawv); Serial.print ("Predata:"); Serial.print (data_Previous); yog (data == ON) {data = data_Previous; Cov ntaub ntawv_LED (); } lwm yog (cov ntaub ntawv == OFF) {cov ntaub ntawv = "0.0.0"; Cov ntaub ntawv_LED (); } lwm {Data_LED (); data_Previous = cov ntaub ntawv; } cov ntaub ntawv = ""; xeev = cuav; }
qhov no yog ntu kawg ntawm lub voj void, yog tias lub xeev kom ntseeg tau tias cov ntaub ntawv tiav yog tias tsis tau khiav sab hauv nws.
FUNCTION DATA LED
int seperator1 = data.indexOf ('-');
int seperator2 = data.indexOf ('-', seperator1+1); int seperator3 = data.indexOf ('-', seperator2+1);
ib feem no nws yog cov cai tseem ceeb, vim tias tau txais ib txoj hlua nws yuav tsum paub qhov sib cais nyob qhov twg. Nws tsis tuaj yeem pom qhov tseem ceeb ntawm RGB qis dua 50, siv qhov ntsuas tawm ntawm nws nws yuav pom tus naj npawb ntawm cov char peb tshawb nrog qhov no peb tuaj yeem paub tus lej twg los pib ua haujlwm hloov pauv.
Txoj hlua R = data.substring (0, seperator1);
Txoj hlua G = data.substring (seperator1+1, seperator2); Txoj hlua B = data.substring (seperator2+1, seperator3);
Tom qab tau txais qhov zoo ntawm txhua qhov txiaj ntsig, subString muaj nuj nqi yuav ua rau txhua tus lej rau txhua qhov sib txawv, cais cais kom paub tseeb tias tsis tau nyeem tus nqi ua ntej nws.
Kauj ruam 4: App Inventor
Qhov kev pabcuam no yuav ua rau pib (zoo li kuv) yooj yim dua los ua hauv app tsuas yog xav tau kev xav, ua siab ntev thiab siv internet
Ua ntej ua GUI yooj yim
Pib npaj lossis ntsuas qhov teeb tsa, muaj ob qho uas kuv tau ua dub yog thawj zaug thiab dawb yog thib ob
2nd qhib MIT APP lossis nyem qhov no
- Puas yog cov kauj ruam no nyem Tsim cov apps! ntawm kaum kaum
- Pib txoj haujlwm tshiab
- Ntaus lub npe
- Pib tsim
Yog tias koj siv kuv lub hauv paus nyem Cov Haujlwm thiab xaiv ntshuam aia
Taw qhia
Ntawm qhov kev pabcuam no koj xav tau lub laj thawj vim tias rau txhua cov ntsiab lus muaj lawv tus kheej xim thiab piav qhia tsuas yog tshawb yog tias tsis nkag siab, nws tsis nyuaj yog tias koj paub nrog tsab ntawv/coding.
Lub ntsiab yog lub log xim thiab cov neeg siv bluetooth, ntawm no yog qhov kev piav qhia
LOJ LOJ
- Lub log xim tau txais tus nqi los ntawm kev ntes tus ntiv tes qhov nws kov
- Cursor yuav ua raws tus ntiv tes nco qab tus cursor qee zaum tsis ua tiav nrog cov phiaj
- Cursor yuav tau txais tus nqi X thiab Y thiab
- Tus nqi no yuav siv los ntawm kev ua haujlwm ntawm getBackgroundPixelColour, ib puag ncig zoo li cov xim xaiv ntawm lwm cov ntawv
- Muaj 3 qhov tseem ceeb (Liab, Ntsuab, Xiav) txhua tus nqi sib cais los ntawm cov npe (pib los ntawm 1)
- Qhov ntawd yog txoj hauv kev yooj yim los ua xim log
BLUETOOTH
- Tom qab tau txais tus nqi thiab xa nws los ntawm kev ntxiv - rau txhua tus cim thiab ntxiv + thaum kawg siv kev lom zem ntawm kev koom nrog
- Xa nws mus rau xov tooj
Kauj ruam 5: Kev sib cav
Thov txim rau kuv cov lus Askiv tsis zoo, kuv tau sim thiab pom qhov teeb meem nrog kuv RGB LED (Lub diode liab yuav tsis tshwm rau qhov xwm txheej zoo kuv siv 100R). Kuv yuav ua tus RGB Sawb yog tias muaj, kuv sim 3trd version kuv lub dav hlau los ua kom muaj ntau yam zoo li tog teeb pom kev, teeb pom kev tog thiab txhim kho qee yam.
Yog tias nws ua haujlwm tiag tiag yog tias tsis kho kuv ib yam. Zoo Siab Coding ^^
Pom zoo:
Qho Khoom Ua Si Bluetooth Tsuav thiab Tsim Android Game Nrog MIT App Inventor: 22 Cov Kauj Ruam (nrog Duab)
Qho Khoom Ua Si Bluetooth Tsuav thiab Tsim Android Game Nrog MIT App Inventor: Ua si tsuav game muaj ntau txoj kev sib txawv 1) Tsoos ua si nrog ntoo lossis tooj dag. 2) Ua si hauv xov tooj los yog pc nrog cov tsuav tus nqi random tsim los ntawm mobile lossis pc.in qhov sib txawv no ua si lub tsuav lub cev thiab txav cov nyiaj npib hauv txawb lossis PC
APP INVENTOR 2 - Huv Lub Hauv Paus Qhia (+4 Piv Txwv): 6 Cov Kauj Ruam
APP INVENTOR 2 - Cov Lus Qhia Ua Ntej Ua Ntej (+4 Piv txwv): Peb yuav pom tias peb tuaj yeem ua koj li App ntawm AI2 zoo li cas zoo nkauj :) Tsis muaj tus lej lub sijhawm no, tsuas yog cov lus qhia rau app yooj yim zoo li 4 piv txwv saum toj
(Ascensor) Elevator Model Siv Arduino, App Inventor thiab Lwm Yam Software Dawb: 7 Kauj Ruam
(Ascensor) Elevator Model Siv Arduino, App Inventor thiab Lwm Yam Software Dawb: ESP de tswj del ascensor) y freeCAD y LibreCAD para diseño.Abajo
Lub Suab Tswj Teeb Hluav Taws Xob RGB Led Strips thiab Ntau Nrog Cortana thiab Arduino Tsev Automation: 3 Kauj Ruam
Lub Suab Tswj Teeb Hluav Taws Xob RGB Led Strips thiab Ntau Nrog Cortana thiab Arduino Tsev Automation: Zoo li lub tswv yim ntawm kev tswj hwm yam nrog koj lub suab? Los yog tsis nyiam tawm ntawm lub txaj los tua teeb? Tab sis txhua qhov kev daws teeb meem zoo li google tsev yog kim heev? Tam sim no koj tuaj yeem ua nws tus kheej rau qis dua $ 10. Thiab txawm tias zoo dua nws yog qhov yooj yim heev
MIT App Inventor Particle Photon Test: 5 Kauj Ruam
MIT App Inventor Particle Photon Test: Peb (Pab Pawg Ua Haujlwm Cov Haujlwm) tau tsim kho cov phiaj xwm txuas nrog Internet siv Particle Photon thiab Electron IoT cov cuab yeej rau qee xyoo tam sim no, saib: https://github.com/TeamPracticalProjectsWe peb tau siv cov kev pabcuam tham nrog peb Pa