Cov txheej txheem:

Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO: 4 Cov Kauj Ruam
Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO: 4 Cov Kauj Ruam

Video: Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO: 4 Cov Kauj Ruam

Video: Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO: 4 Cov Kauj Ruam
Video: Plab Plab Ntswg..(Pluav Pluav Ntswg) Maiv Twm New Song 2023-2024 2024, Lub Xya hli ntuj
Anonim
Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO
Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO
Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO
Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO
Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO
Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO
Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO
Tswj Chaw Taws Teeb Bluetooth Tsheb Siv Arduino UNO

Nws ib txwm yuav txaus siab los pib ua qhov peb tau kawm txog tam sim no hauv Arduino. Qhov tseeb, feem ntau ntawm txhua tus neeg yuav mus nrog cov hauv paus.

Yog li ntawm no kuv tsuas yog piav qhia txog Arduino raws li Lub Tsheb Tswj Chaw.

Yuav tsum:

1. Arduino UNO (1)

2. Bluetooth Module (1)

3. Tsheb Chassis

4. BO Tsav

5. 9V Roj Teeb (Zoo dua yog tias nws yog 12V 7AH Rechargeable Battery kom ua tau zoo dua)

6. Tsav tsheb L293D

Txhua tus neeg saib rau kev piav qhia zoo dua ntawm kev tsim cov bots no, ntau qhov kev piav qhia feem ntau yog ua raws kev sib txuas los ntawm kev sib txuas

Kev sib txuas hauv Circuit Court yog yooj yim li sai tau. Ntawm no kuv yuav piav qhia ntau ntxiv txog cov cai thiab txuas raws nws

Kauj Ruam 1: Kev Ua Haujlwm Yooj Yim

Txhua yam peb yuav tsum ua yog tsim lub tsheb RC Bluetooth los ntawm tsis muaj dab tsi. Peb tau tham txog qhov yuav tsum tau ua rau txoj haujlwm no. Ntawm no kuv yuav nthuav qhia daim ntawv thov uas ua haujlwm tau yooj yim peb tswj hwm ib feem ntawm peb lub tsheb. Yog li cov cim yuav raug xa los ntawm daim ntawv thov cuam tshuam rau txoj haujlwm uas peb cuam tshuam nrog. Piv txwv li, Ib qho 'F' yuav raug xa mus rau Bluetooth yog tias koj nias lub pob rau pem hauv ntej. Yog li peb tuaj yeem sau tus lej Arduino tias kev txav mus los zoo yuav tsum tsim nrog lub tshuab txuas (yuav piav qhia tom qab).

Thawj ntu ntawm txoj cai

int m11 = 11, m12 = 10, m21 = 9, m22 = 6;

char cov ntaub ntawv = 0;

void teeb tsa ()

{

Serial.begin (9600);

pinMode (m11, NTAWV);

pinMode (m12, NTAWV);

pinMode (m21, NTAWV);

pinMode (m22, NTAWV); }

Thawj kab ntawm txoj cai muab lub npe rau txhua tus pin ntawm peb lub microcontroller. Cov plaub tus pin no yog txuas rau 4 xov hlau ntawm Tsav.

Serial.begin (0): Teem cov ntaub ntawv tus nqi hauv cov khoom ib ob (baud) rau cov ntaub ntawv xa tawm

pinMode: Tus pinMode () ua haujlwm tau siv los teeb tsa tus pin tshwj xeeb los coj tus yam ntxwv raws li kev nkag los lossis tso tawm. (Ntawm no peb tau txuas lub cev muaj zog raws li Kev Tsim Tawm.

Vam tias txhua tus tau txais lub tswv yim zoo no txog qhov pib ua ntej ntawm txoj cai.

Kauj ruam 2: Program:)

void voj () {

yog (Serial.available ()> 0) {

cov ntaub ntawv = Serial.read ();

Serial.print (cov ntaub ntawv);

Serial.print ("\ n");

yog (cov ntaub ntawv == 'F')

rau pem hauv ntej ();

lwm yog tias (cov ntaub ntawv == 'B')

rov qab ();

lwm yog (data == 'L')

sab laug ();

lwm yog tias (cov ntaub ntawv == 'R')

txoj cai ();

lwm tus

astop (); }

Nov yog cov haujlwm tseem ceeb ntawm peb txoj haujlwm. Txog tam sim no peb tau hais qhia qhov xwm txheej ntawm tus pin thiab seb nws cov zis lossis cov tswv yim tawm. Nov ntawm no [ntu, peb tab tom mus rau qhov laj thawj tsim nyog. Raws li peb tau txuas nrog Bluetooth module nrog Arduino. Serial.available: Tau txais tus lej bytes (cim) muaj rau nyeem los ntawm chaw nres nkoj txuas. Qhov no yog cov ntaub ntawv uas twb tau los txog thiab khaws cia hauv cov ntawv tau txais tsis (uas tuav 64 bytes). muaj () tau txais los ntawm kwj dej siv hluav taws xob.

Raws li peb tau txuas nrog Bluetooth module. Tus lej muaj nyob yuav yog cov ntaub ntawv sib xws rau koj qhov kev ua hauv daim ntawv thov. Li no raws li kuv tau hais ua ntej, Peb yuav tsum muab cov lej txav mus tom ntej coj mus rau 'F' cov ntaub ntawv los ntawm app.

Yog li cov ntaub ntawv los ntawm daim ntawv thov raug khaws cia hauv cov ntaub ntawv sib txawv siv cov haujlwm ua lag luam.read.

Thaum koj txheeb xyuas Daim Ntawv Thov teeb tsa nws yuav raug sau cov tsiaj ntawv sib xws rau txhua txoj haujlwm.

Yog li siv yog ua haujlwm txhua tus tsiaj ntawv tau teev tseg nrog nws cov txheej txheem.

{Yog xav paub ntau ntxiv koj tuaj yeem tshawb xyuas.ino cov ntaub ntawv xa nrog cov lus qhia no}

Kauj Ruam 3: Kev Sib Txuas Circuit

Kev Txuas Hluav Taws Xob
Kev Txuas Hluav Taws Xob
Kev Txuas Hluav Taws Xob
Kev Txuas Hluav Taws Xob

Kev sib txuas hauv Circuit yog yooj yim li sai tau. Txhua yam koj yuav tsum paub yog tias pins txuas nrog raws li tau teev tseg rau Arduino code. Cov kev sib txuas tsav tsheb saum toj no tuaj yeem hloov pauv raws li muaj nyob hauv khw. Koj tsuas yog tshawb nrhiav kev sib txuas hauv is taws nem.

Ntawm no peb yuav tsum xyuas kom muaj kev sib txuas rau Bluetooth Module, Tsav tsheb thiab Arduino pins.

Tsav Tsheb: Cias txuas tus tsav tsheb sib txuas raws li qhia hauv daim duab saum toj no. Nws tau siv los ua lub zog rau lub cav txij li tus pin los ntawm Arduino tsuas yog muab lub teeb liab. Nws tsis muaj lub hwj chim los tswj lub cav. Yog li nce qib lub teeb liab lub cev yog tus tsav tsheb ua haujlwm li cas. Yuav muaj FOUR tswj cov cim qhia los ntawm Arduino thiab txuas lawv feem. Lub Hwj Huam Pin thiab Hauv av tus pin yuav nyob tam sim no.

Bluetooth Module: Nws muaj VCC, GND, Tx, Rx Pins. Dab tsi koj yuav tsum tau saib xyuas yog tias Tx thiab Rx pins yuav tsum tsis txuas nrog thaum Txoj Cai tau muab tso rau. Tx thiab Rx ntawm Bluetooth yuav tsum txuas rau Rx thiab Tx ntawm Arduino feem.

Kauj ruam 4: Bluetooth App

play.google.com/store/apps/details?id=brau…

Txheeb xyuas Daim Ntawv Thov saum toj no, nyob hauv cov chaw ntawm App koj tuaj yeem pom cov tsiaj ntawv sib raug raug xa mus rau qhov tshwj xeeb uas peb tau ua.

Txoj Cai Kuv tau muab ntawm no yog nrog cov cim los ntawm Bluetooth app saum toj no.

Pom zoo: