Cov txheej txheem:

Plotting Real-time Graph ntawm Android Los Ntawm Arduino Los Ntawm HC-05: 3 Cov Kauj Ruam
Plotting Real-time Graph ntawm Android Los Ntawm Arduino Los Ntawm HC-05: 3 Cov Kauj Ruam

Video: Plotting Real-time Graph ntawm Android Los Ntawm Arduino Los Ntawm HC-05: 3 Cov Kauj Ruam

Video: Plotting Real-time Graph ntawm Android Los Ntawm Arduino Los Ntawm HC-05: 3 Cov Kauj Ruam
Video: PROOF THE MATRIX IS ACTUALLY REAL...😳 2024, Lub rau hli ntuj
Anonim
Plotting Lub Sijhawm Tiag Ntawm Android Los Ntawm Arduino Los Ntawm HC-05
Plotting Lub Sijhawm Tiag Ntawm Android Los Ntawm Arduino Los Ntawm HC-05

Nyob zoo, Nov yog kev qhia qhia yuav ua li cas npaj lub phiaj xwm ntawm lub sijhawm tiag tiag los ntawm tus tswj hwm micro xws li Arduino rau lub app. Nws siv Bluetooth qauv xws li HC-05 los ua lub cuab yeej xa xov mus rau kis thiab tau txais cov ntaub ntawv ntawm Arduino thiab Android.

Lub app yooj yim siv thiab tuaj yeem siv rau lwm lub hom phiaj xws li tus tswj hwm los tswj lub tsheb neeg hlau, lub ntsuas saib, zoo ib yam uas tau muab los ntawm Arduino IDE, kom tau txais cov ntawv xov xwm thiab xa cov ntaub ntawv tseem ceeb.

NYEEM CHIT-CHAT TUS TSEV KAWM NTAWV

Khoom siv

  1. Arduino nano lossis mega
  2. Serialize Bluetooth app (https://play.google.com/store/apps/details?id=com.athenaDEVKE.bluetoothserialcommunication)
  3. HC-05
  4. Txiv neej jumper xov hlau
  5. 10K thiab 20K resistors los tsim qhov faib hluav taws xob. Yog tias tsis siv ob tus tiv thaiv zoo sib xws ntawm tus nqi nruab nrab hauv kab ntawv tseem yuav ua haujlwm.

Kauj Ruam 1: Schematic thiab Kev Sib Txuas

Schematic thiab Kev Sib Txuas
Schematic thiab Kev Sib Txuas
Schematic thiab Kev Sib Txuas
Schematic thiab Kev Sib Txuas
Schematic thiab Kev Sib Txuas
Schematic thiab Kev Sib Txuas
Schematic thiab Kev Sib Txuas
Schematic thiab Kev Sib Txuas
  • Txuas cov cuab yeej raws li qhia saum toj no thiab lub zog ntawm tus qauv
  • Rub cov ntawv xeem hauv qab no:

#suav nrog // Txuas bluetooth module HC-05 lossis HC-06 rau arduino thiab tshaj tawm cov koob siv yog tias koj npaj yuav siv cov software txuas

// Siv los txheeb xyuas qhov teeb meem

String graphTag = "Duab:";

// Siv los txheeb xyuas qhov sib cais ntawm qhov tseem ceeb hauv kwj

char tus nqiSeparatorCharacter = '&';

// Siv los txheeb xyuas qhov kawg ntawm cov kwj. Qhov no yuav siv rau ob qho tib si saib thiab teeb duab

char lus terminati

  • Xyuas kom koj rub tawm Serialize Bluetooth-Plotter, davhlau ya nyob twg & tswj (https://play.google.com/store/apps/details?id=com….).
  • Ua ntej kom ntseeg tau tias koj tau ua khub hc-05 module nrog koj lub xov tooj, tom qab ntawd pib lub app
  • Xaiv lub Configure tab. Nyem rau ntawm qhov ua kom tshiab ntxiv rau lub thawv combo. Xaiv qhov module los ntawm lub thawv combo. Tom qab ntawd nyem lub pob txuas thiab tos rau cov lus tshwm uas hais tias lub cuab yeej txuas nrog.
  • Nyem qhov teeb tsa teeb tsa thiab teeb tsa kab kos, xaiv hom kab teeb, teeb tsa tus cwj pwm uas siv los cais cov txiaj ntsig thiab txiav tus yam ntxwv.

;

void teeb tsa () {

// Tshaj tawm tus nqi baud. Lub app tsuas yog txhawb nqa 9600

mySerial.begin (9600);

}

void voj () {

// Ib qho piv txwv piv txwv ntawm kev teeb tsa lub sine wave

rau (ntab x = -2 * PI; x <= 2 * PI; x = x + PI / 50) {

mySerial.print (graphTag);

mySerial.print (240 * sin (x));

mySerial.print (valueSeparatorCharacter);

mySerial.print (240 * sin (x + (2 * PI / 3))));

mySerial.print (valueSeparatorCharacter);

mySerial.print (240 * sin (x + (4 * PI / 3))));

mySerial.print (kev txiav tawm cais tus cwj pwm);

}

}

  • Xyuas kom koj rub tawm Serialize Bluetooth-Plotter, davhlau ya nyob twg & tswj (https://play.google.com/store/apps/details?id=com….).
  • Ua ntej kom ntseeg tau tias koj tau ua khub hc-05 module nrog koj lub xov tooj, tom qab ntawd pib lub app
  • Xaiv lub Configure tab. Nyem rau ntawm qhov ua kom tshiab ntxiv rau lub thawv combo. Xaiv tus qauv los ntawm lub thawv combo. Tom qab ntawd nyem rau khawm txuas thiab tos rau cov lus tshwm uas hais tias lub cuab yeej txuas nrog.
  • Nyem qhov teeb tsa teeb tsa thiab teeb tsa daim duab teeb, xaiv hom kab teeb, teeb tsa tus cwj pwm siv los cais cov txiaj ntsig thiab txiav tus yam ntxwv.

Kauj ruam 2: Nyeem Cov Tswv Yim Los Ntawm App

Nyeem cov tswv yim los ntawm App
Nyeem cov tswv yim los ntawm App
  • Nrog tib teeb tsa zoo li saum toj no:
  • Upload cov cai hauv qab no:

#suav nrog SoftwareSerial mySerial (12, 11); // Zoo li ib txwm teeb tsa upp tx thiab rx pins

void teeb tsa () {

// Baud tus nqi ntawm bluetooth module yuav tsum tau teeb tsa rau 9600 txhawm rau sib tham nrog app

mySerial.begin (9600);

// Tau teeb tsa rau tus nqi baud yam koj xav tau

Serial.begin (9600);

}

void voj () {

yog (mySerial.available ()> 0) {

// Thaum tau txais cov ntaub ntawv nyeem kab upto kab tshiab

Txoj hlua inputString = mySerial.readStringUntil ('\ n'); // Nyeem cov ntawv nkag mus rau kab tshiab

// Sau txoj hlua

Serial.println (inputString);

}

}

Ntsuas tus tswj hwm thiab saib xyuas qhov tso tawm ntawm lub ntsuas saib thiab voilà koj tab tom nyeem cov ntaub ntawv los ntawm app

Kauj Ruam 3: Txheeb Xyuas Video/Rov Ua Dua

Yog tias koj tab tom ntsib teeb meem, thov ua raws cov vis dis aus saum toj no

Pom zoo: