bahan yang dibutuhkan :
1. Paket Chasis smart motor robot car kit (beli di topokopedia)
2. Driver motor module HG7881
3. Bluetooth HC05
4. Arduino Uno
5. led 2 (lampu depan dan belakang biar tambah kece)
6. powerbank
tutorial :
1. upload sketch
Download apk at playstore Tutorial Car Bluetooth Arduino (include sketch and wiring)
2. pasang kabel (play video)
3. download aplikasi Bluetooth RC Controller
4. Pairing dulu bluetoothnya password :1234
5. run aplikasi tadi. klik gambar setting (samping kanan segitiga)
6. connect to car
7.Run............. GOooooooooooooooo.......................
mobil ini bisa dijalankan mode sensor
cek di video.. keren abis...
programnya kok terjadj eror ya gan, 'command' was not declared in this scope
BalasHapus
BalasHapusconst int AIA = 9; // (pwm) pin 9 connected to pin A-IA
const int AIB = 5; // (pwm) pin 5 connected to pin A-IB
const int BIA = 10; // (pwm) pin 10 connected to pin B-IA
const int BIB = 6; // (pwm) pin 6 connected to pin B-IB
int lampudepan = 11;
int lampubelakang = 12;
int horn = 4;
byte speed = 255; // change this (0-255) to control the speed of the motors
char command;
void setup() {
Serial.begin(9600);
pinMode(AIA, OUTPUT); // set pins to output
pinMode(AIB, OUTPUT);
pinMode(BIA, OUTPUT);
pinMode(BIB, OUTPUT);
pinMode(lampudepan, OUTPUT);
pinMode(lampubelakang, OUTPUT);
pinMode(horn, OUTPUT);
}
void loop() {
if(Serial.available() > 0){
command = Serial.read();
Stop(); //initialize with motors stoped
//Change pin mode only if new command is different from previous.
//Serial.println(command);
switch(command){
case 'F':
Forward();
break;
case 'B':
Back();
break;
case 'L':
Left();
break;
case 'R':
Right();
break;
}
}
if(command=='W'){
digitalWrite(lampudepan,HIGH);
}
if (command=='w'){
digitalWrite(lampudepan,LOW);
}
if(command=='U'){
digitalWrite(lampubelakang,HIGH);
}
if (command=='u'){
digitalWrite(lampubelakang,LOW);
}
if(command=='V'){
digitalWrite(horn,HIGH);
}
if (command=='v'){
digitalWrite(horn,LOW);
}
}
void Forward()
{
analogWrite(AIA, 0);
analogWrite(AIB, speed);
analogWrite(BIA, 0);
analogWrite(BIB, speed);
}
void Back()
{
analogWrite(AIA, speed);
analogWrite(AIB, 0);
analogWrite(BIA, speed);
analogWrite(BIB, 0);
}
void Left()
{
analogWrite(AIA, speed);
analogWrite(AIB, 0);
analogWrite(BIA, 0);
analogWrite(BIB, 0);
}
void Right()
{
analogWrite(AIA, 0);
analogWrite(AIB, 0);
analogWrite(BIA, speed);
analogWrite(BIB, 0);
}
void Stop()
{
analogWrite(AIA, 0);
analogWrite(AIB, 0);
analogWrite(BIA, 0);
analogWrite(BIB, 0);
}
hargax yg kita bikin brapa gan
BalasHapus400rb
Hapus