Cov txheej txheem:

Bluetooth Neeg Hlau Mio: 4 Kauj Ruam
Bluetooth Neeg Hlau Mio: 4 Kauj Ruam

Video: Bluetooth Neeg Hlau Mio: 4 Kauj Ruam

Video: Bluetooth Neeg Hlau Mio: 4 Kauj Ruam
Video: В ПРОКЛЯТОМ ДОМЕ ПРИЗРАК ПОКАЗАЛ ЧТО С НИМ СЛУЧИЛОСЬ /IN A CURSED HOUSE WITH A GHOST 2024, Kaum ib hlis
Anonim
Bluetooth Neeg Hlau Mio
Bluetooth Neeg Hlau Mio

Kauj ruam 1: Cov ntaub ntawv

Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv

1- Neeg Hlau Mio

2- L298N Voltage Regulator Dual Tsav Tsav Tsav

3- Arduino Nano

4- HC06 Bluetooth-Serial Module Board

5- (2x) 9 V Roj Teeb Lub taub hau

Kauj Ruam 2: Sib Sau Ua Ke

Sib Sau Ua Ke
Sib Sau Ua Ke
Sib Sau Ua Ke
Sib Sau Ua Ke
Sib Sau Ua Ke
Sib Sau Ua Ke
Sib Sau Ua Ke
Sib Sau Ua Ke

Cia peb pib nrog cov tsav tsheb sib txuas ua ntej Cia peb txuas cov hlua txuas hauv qab hauv 1, in2, in3, in4 pins ntawm tus tsav tsheb. (raws li daim duab 1) Tom qab ntawd cia peb xaim cable hauv in1 rau nano tus d6 tus pin, in2 rau d10 tus pin, in3 rau d5 tus pin, thiab thaum kawg lub cable hauv in4 rau d9 tus pin. (zoo li hauv daim duab 2) Tam sim no, cia ua qhov txuas ntawm peb HC06 module, cia xaim RXD tus pin rau TXD tus pin ntawm nano, TXD tus pin rau RXD tus pin, VCC thiab GND pins rau ib qho 5v thiab GND pins ntawm nano. (raws li pic3) Thiab thaum kawg, cia ua lub cav sib txuas. Thaum Mio tab tom ntsib peb, cia peb txuas txoj kab hluav taws xob zoo mus rau qhov tawm 3, 4 tus pin ntawm tus tsav tsheb thiab sab laug lub cev muaj zog txuas mus rau out1, 2 tus pin. tus nano thiab cov hlua dub rau GND tus pin. (raws li daim duab 4) Thiab cia peb txiav lub jumper hlau nyob hauv nruab nrab, hle qhov kawg thiab txuas nws mus rau GND tus pin ntawm nano, mus rau GND tus pin ntawm tus tsav tsheb. (raws li daim duab 5, 6) Cia peb txuas kab liab liab ntawm lwm 9v lub taub hau roj teeb mus rau 12v tus pin thiab cov hlua dub rau tus pin gnd ntawm tus tsav tsheb lub zog tsav. (raws li hauv daim duab 7)

Kauj ruam 3: Coding Nano

const int motorA1 = 5; // L298N'in IN3 Girişi

const int motorA2 = 6; // L298N'in IN1 Girişi const int motorB1 = 10; // L298N'in IN2 Girişi const int motorB2 = 9; // L298N'in IN4 Girişi

int ib = 0; // Döngüler için atanan rastgele bir değişken int j = 0; // Lub tsev kawm ntawv qib siab lossis tsev kawm qib siab; // Bluetooth cihazından gelecek sinyalin değişkeni int vSpeed = 255; // Standart Hız, 0-255 arası bir değer alabilir

void teeb () {// Pinlerimizi belirleyelim pinMode (motorA1, OUTPUT); pinMode (motorA2, OUTPUT); pinMode (motorB1, OUTPUT); tus pinMode (motorB2, OUTPUT); // 9600 baud hızında bir seri chaw nres nkoj açalım Serial.begin (9600); } void loop () {// Bluetooth bağlantısı koptuğunda veya kesildiğinde arabayı durdur. // (Aktif etmek için alt satırın "//" larını kaldırın.) // yog (digitalRead (BTState) == LOW) {xeev = 'S'; }

// Gelen veriyi 'xeev' değişkenine kaydet yog (Serial.available ()> 0) {state = Serial.read (); } // Uygulamadan ayarlanabilen 4 hız seviyesi. (Değerler 0-255 arasında olmalı) yog (xeev == '0') {vSpeed = 0;} ntxiv yog (xeev == '1') {vSpeed = 100;} ntxiv yog (xeev == '2') {vSpeed = 180;} lwm qhov yog (xeev == '3') {vSpeed = 200;} lwm qhov yog (xeev == '4') {vSpeed = 255;} /*** **************************************************************************************/ // Gelen veri 'F' ise araba ileri gider. yog (xeev == 'F') {analogWrite (motorA1, vSpeed); analogWrite (motorA2, 0); analogWrite (motorB1, vSpeed); analogWrite (motorB2, 0); } /********************** İleri Sol ************************ /// Gelen veri 'G' ise araba ileri sol (çapraz) gider. lwm yog (xeev == 'G') {analogWrite (motorA1, vSpeed); analogWrite (motorA2, 0); analogWrite (motorB1, 100); analogWrite (motorB2, 0); } /********************** İleri Sağ ************************ /// Gelen veri 'Kuv' ise araba ileri sağ (çapraz) gider. lwm yog (xeev == 'Kuv') {analogWrite (motorA1, 100); analogWrite (motorA2, 0); analogWrite (motorB1, vSpeed); analogWrite (motorB2, 0); } /*********************** Geri ************************ ****/// Gelen veri 'B' ise araba geri gider. lwm yog (xeev == 'B') {analogWrite (motorA1, 0); analogWrite (motorA2, vSpeed); analogWrite (motorB1, 0); analogWrite (motorB2, vSpeed); } /********************** Geri Sol ************************ /// Gelen veri 'H' ise araba geri sol (çapraz) gider lwm tus yog (xeev == 'H') {} /********************* *Geri Sağ ************************/// Gelen veri 'J' ise araba geri sağ (çapraz) gider lwm tus yog (xeev == ' J ') {analogWrite (motorA1, 0); analogWrite (motorA2, vSpeed); analogWrite (motorB1, 0); analogWrite (motorB2, 100); } /*************************** Sol ******************** *********/// Gelen veri 'L' ise araba sola gider. lwm yog (xeev == 'L') {analogWrite (motorA1, vSpeed); analogWrite (motorA2, 150); analogWrite (motorB1, 0); analogWrite (motorB2, 0); } /*************************** Sağ ******************** *********/// Gelen veri 'R' ise araba sağa gider lwm tus yog (xeev == 'R') {analogWrite (motorA1, 0); analogWrite (motorA2, 0); analogWrite (motorB1, vSpeed); analogWrite (motorB2, 150); } /************************ Nres *********************** ******/// Gelen veri 'S' ise arabayı durdur. lwm yog (xeev == 'S') {analogWrite (motorA1, 0); analogWrite (motorA2, 0); analogWrite (motorB1, 0); analogWrite (motorB2, 0); }} analogWrite (motorA1, 0); analogWrite (motorA2, 100); analogWrite (motorB1, 0); analogWrite (motorB2, vSpeed);

Kauj Ruam 4: Txhim Kho Qhov Chaw ntawm Mio

Txhim Kho Qhov Chaw ntawm Mio
Txhim Kho Qhov Chaw ntawm Mio
Txhim Kho Qhov Chaw ntawm Mio
Txhim Kho Qhov Chaw ntawm Mio
Txhim Kho Qhov Chaw ntawm Mio
Txhim Kho Qhov Chaw ntawm Mio

Tam sim no peb nyob rau theem kawg los koom ua ke mio neeg hlau

Pom zoo: