Tutorial Arduino Toy Car Bluetooth App Inventor Wear Os
by pierfra71 in Circuits > Arduino
537 Views, 0 Favorites, 0 Comments
Tutorial Arduino Toy Car Bluetooth App Inventor Wear Os
This is a simply Arduino project using an old toy car.
With app inventor you can move the toy car using a smartphone or a wear os watch using "Minimal ADB and Fastboot" to install the apk file.
sources:
Supplies
- arduino mini pro 5v
- HC-05 bluetooth module
- HG7881-(L9110)-Dual-Channel-Motor-Driver-Module
- 18650 box battery
- 2 x 18650 battery
- wires
Arduino Pro Mini 5v
if (Genotronex.available()){
BluetoothData=Genotronex.read(); Serial.println(BluetoothData);}
if ( BluetoothData == 50) motorB('L');// Turn motor B to LEFT; if ( BluetoothData == 51) motorB('R');// Turn motor B to RIGHT; if ( BluetoothData == 49) motorB('O');// Turn motor B to OFF; if ( BluetoothData == 52) motorA('O');// Turn motor A to OFF; if ( BluetoothData == 53) motorA('S');// Turn motor A to SLOW; if ( BluetoothData == 54) motorA('R');// Turn motor A to FAST; if ( BluetoothData == 55) {if (A1A == 3) {A1A = 5; A1B = 3;} else {A1A = 3; A1B = 5;}} // Reverse motor A; delay(5); }
void motorA(char d) { if(d =='R'){ PW = 180; digitalWrite(A1A,LOW); analogWrite(A1B,PW); }else if (d =='S') { PW = 120; digitalWrite(A1A,LOW); analogWrite(A1B,PW); }else{ analogWrite(A1A,0); analogWrite(A1B,0); } }// motorA end
void motorB(char d) { if(d =='R'){ digitalWrite(B1A,LOW); digitalWrite(B1B,HIGH); analogWrite(A1B,PW+10); //more power }else if(d =='L'){ digitalWrite(B1A,HIGH); digitalWrite(B1B,LOW); analogWrite(A1B,PW+10); //more power }else{ // Turn motor OFF digitalWrite(B1A,LOW); digitalWrite(B1B,LOW); }
}// motorB end
HC-05 Bluetooth
TX --> D10
RX --> D11
BLUETOOTH MODULE
HG7881
HG7881-(L9110)-Dual-Channel-Motor-Driver-Module
A1A = 3;//define pin 3 for A1A
A1B = 5;//define pin 5 for A1B
B1A = 4;//define pin 4 for B1A
B1B = 6;//define pin 6 for B1B
BATTERY
2 X 18650 BATTERY
(TWO BATTERIES)
Sources
arduino code (.ino) app inventor (.aia) app(.apk):
https://drive.google.com/drive/u/0/folders/1Ac6bhwlNySt2qFiFVqKxQU_i8GBtwY4Y