syeddaanish2000
Published © MIT

Easiest Bluetooth car using Arduino and MIT app inventor

Control bluetooth car using arduino and HC-05 or 06 and MIT app inventor. Better to use with LEGO.

BeginnerFull instructions provided8,314
Easiest Bluetooth car using Arduino and MIT app inventor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
optional (recommended)
×1
Arduino Mega 2560
Arduino Mega 2560
optional (i used)
×1
Arduino Nano R3
Arduino Nano R3
optional
×1
Adafruit l293 motor shield
×1
Jumper wires (generic)
Jumper wires (generic)
×4
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
optional
×2
DC Motor, 12 V
DC Motor, 12 V
×2
shooter
attach o servo (i used lego ninjago kai shooters)
×2
cardboard
for making the base (i used lego minecraft and ninjago)
×1

Software apps and online services

MIT App Inventor 2
MIT App Inventor 2
to edit app
my app

Story

Read more

Schematics

with shield (mega or uno)

better to use

with shield (mega or uno)

better to use

without shield

without shield

Code

with shield

C/C++
#include <SoftwareSerial.h>
SoftwareSerial mySerial(52, 53); // RX and TX can be edited 
String BT_input;
int LED = 13;
#include <Servo.h>
Servo s;
Servo s2;
#include <AFMotor.h>
AF_DCMotor motor(1);
AF_DCMotor motor1(4);
void setup() {
 Serial.begin(9600);
 mySerial.begin(9600);
 s.attach(10);
 s2.attach(9);
 s2.write(0);
 s.write(0);
 pinMode(LED, OUTPUT);
 motor.setSpeed(255);
 motor1.setSpeed(255);
 motor.run(RELEASE);
 motor1.run(RELEASE);
}
void loop() {
 if (mySerial.available())
   {
       BT_input = mySerial.read();
       Serial.println(BT_input);
       if (BT_input=="1")
       {
         front();
       }
       if (BT_input=="3")
       {
         back();
       }
       if (BT_input=="2")
       {
         right();
       }
       if (BT_input=="4")
       {
         left();
       }
       if (BT_input=="5")
       {
         stop();
       }
       if (BT_input=="6")
       {
         shoot();
       }
       if (BT_input=="7")
       {
         shoot2();
       }
   }
}
void front(){
 motor.run(FORWARD);
 motor1.run(FORWARD);
}
void back(){
 motor.run(BACKWARD);
 motor1.run(BACKWARD);
}
void left(){
 motor.run(BACKWARD);
 motor1.run(FORWARD);
}
void right(){
 motor.run(FORWARD);
 motor1.run(BACKWARD);
}
void stop(){
 motor.run(RELEASE);
 motor1.run(RELEASE);
}
void shoot(){
 s.write(120);
 delay(100);
 s.write(0);
}
void shoot2(){
 s2.write(120);
 delay(100);
 s2.write(0);
}

without shield

C/C++
#include <SoftwareSerial.h>
SoftwareSerial mySerial(52, 53); // RX and TX can be edited 
String BT_input;
int LED = 13;
#include <Servo.h>
Servo s;
Servo s2;

const int Motor_L_F = 2;
const int Motor_L_B = 3;
const int Motor_R_F = 4;
const int Motor_R_B = 5;
void setup() {
     
}
void loop() {
 if (mySerial.available())
   {
       BT_input = mySerial.read();
       Serial.println(BT_input);
       if (BT_input=="1")
       {
         front();
       }
       if (BT_input=="3")
       {
         back();
       }
       if (BT_input=="2")
       {
         right();
       }
       if (BT_input=="4")
       {
         left();
       }
       if (BT_input=="5")
       {
         stop();
       }
       if (BT_input=="6")
       {
         shoot();
       }
       if (BT_input=="7")
       {
         shoot2();
       }
   }
}
void Forward(){
 digitalWrite(Motor_L_F, HIGH);
 digitalWrite(Motor_L_B, LOW);
 digitalWrite(Motor_R_F, HIGH);
 digitalWrite(Motor_R_B, LOW);
 }
void Right(){
 digitalWrite(Motor_R_F, LOW);
 digitalWrite(Motor_R_B, HIGH);
 digitalWrite(Motor_L_F, HIGH);
 digitalWrite(Motor_L_B, LOW);
 }
void Left(){
 digitalWrite(Motor_L_F, LOW);
 digitalWrite(Motor_L_B, HIGH);
 digitalWrite(Motor_R_F, HIGH);
 digitalWrite(Motor_R_B, LOW);
 }
void Back(){
 digitalWrite(Motor_L_F, LOW);
 digitalWrite(Motor_L_B, HIGH);
 digitalWrite(Motor_R_F, LOW);
 digitalWrite(Motor_R_B, HIGH);
 }
void Stop(){
 digitalWrite(Motor_L_F, LOW);
 digitalWrite(Motor_L_B, LOW);
 digitalWrite(Motor_R_F, LOW);
 digitalWrite(Motor_R_B, LOW);
 }
void shoot(){
 s.write(120);
 delay(100);
 s.write(0);
}
void shoot2(){
 s2.write(120);
 delay(100);
 s2.write(0);
}

Github

Credits

syeddaanish2000

syeddaanish2000

0 projects • 0 followers

Comments