DongGeun Leegledel
Published

Making a Bluetooth RC Car!

I made a moving RC car through Bluetooth.

AdvancedWork in progress3 hours379
Making a Bluetooth RC Car!

Things used in this project

Hardware components

Jumper wires (generic)
Jumper wires (generic)
×1
9V battery (generic)
9V battery (generic)
×1
9V Battery Clip
9V Battery Clip
×1
Arduino Nano R3
Arduino Nano R3
×1
Delrin V Wheel Kit
OpenBuilds Delrin V Wheel Kit
×1
Bluetooth Low Energy (BLE) Module (Generic)
×1
DC motor (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Modulo Motor Driver
Modulo Motor Driver
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Bluetooth RC car

Arduino
Just see
#include <SoftwareSerial.h>

SoftwareSerial BTSerial(11, 12);

#define EN1 3 
#define EN2 4 

#define EN3 6  
#define EN4 7  

int carSpeed = 200; 

void setup() {
  BTSerial.begin(9600);  
  
 
  pinMode(EN1, OUTPUT);
  pinMode(EN2, OUTPUT);

  
  pinMode(EN3, OUTPUT);
  pinMode(EN4, OUTPUT);
}

void loop() {

  if (BTSerial.available()) {

    char command = BTSerial.read(); 
    
    if (command == 'F' || command == 'f') {
      
      moving_forward();
    }
    else if (command == 'B' || command == 'b') {
      
      moving_backward();
    }
    else if (command == 'L' || command == 'l') {
      
      
      moving_left();
    }
    else if (command == 'R' || command == 'r') {
      
      
      moving_right();
    }
    else if (command == 'S' || command == 's') {
      
      stop_moving();
    }
    else {
  
      stop_moving();
    }

  }

 
  delay(100);
}

void moving_forward() {
 
  digitalWrite(EN1, HIGH);
  digitalWrite(EN2, LOW);

 
  digitalWrite(EN3, HIGH);
  digitalWrite(EN4, LOW);
}

void moving_backward() {
 
  digitalWrite(EN1, LOW);
  digitalWrite(EN2, HIGH);

 
  digitalWrite(EN3, LOW);
  digitalWrite(EN4, HIGH);
}

void moving_left() {
 
  digitalWrite(EN1, HIGH);
  digitalWrite(EN2, LOW);

  
  digitalWrite(EN3, LOW);
  digitalWrite(EN4, HIGH);
}

void moving_right() {
 
  digitalWrite(EN1, LOW);
  digitalWrite(EN2, HIGH);

 
  digitalWrite(EN3, HIGH);
  digitalWrite(EN4, LOW);
}

void stop_moving() {
  digitalWrite(EN1, LOW);
  digitalWrite(EN2, LOW);
  digitalWrite(EN3, LOW);
  digitalWrite(EN4, LOW);
}

Credits

DongGeun Lee

DongGeun Lee

4 projects • 0 followers
Hi, glad to meet you. I'm a high school student and studying arduino now. I look forward to your kind cooperation. thx :)
gledel

gledel

100 projects • 91 followers
Looking back on my childhood, I was happy when I was making something and I was proud of myself. "Making is instinct!"

Comments