By Leff
This short simple post is to show you a simple example on how to use Romeo BLE to control 2WD car wirelessly by a BLE supported phone/ BT 2.0 phone/ PC.

:arrow: Requirement:
Romeo BLE x1
Motor DC x2
External power supply DC x1 _Any power supply @6-12V is ok
USB cable x1 _to download program

Wireless Controller Choices:

1 If you want to use PC as a controller, then anothor BLE module from DFRobot is needed. This is only a suggested one, any other BLE module is ok. Plug it onto your pc, connect it with Romeo BLE (more info plz follow its wiki), then use any Serial Monitor to send command.

2 If you want to use your phone as the controller, you have to check if your phone is supported BLE, check here., if supported, then you could download the App made by DFRobot_Github, if not, this board is not suitable for you, you can choose to buy Romeo+BT bee module(Bluetooth 2.0) to replace the Romeo BLE.

3 If you want to use another BLE devices/module as the controller, you have to make sure it's from DFRobot, other bands BLE module are NOT comatible with ours. Sorry about this, we will improve this compatibility in the near future!

:arrow: STEPS

1 Upload the sketch below: (if you use Romeo, plz use Serial1.***() instead of Serial.***() for serial devices in the code.)
Code: Select all
int E1 = 5;     //define M1 enable pin
int E2 = 6;     //define M2 enable pin
int M1 = 4;    //define M1 speed pin
int M2 = 7;    //define M2 speed pin

void stop() {                //stop
  digitalWrite(E1, LOW);
  digitalWrite(E2, LOW);
void advance(char a, char b) {         //forward
  analogWrite (E1, a);            //PWM speed control
  digitalWrite(M1, HIGH);
  analogWrite (E2, b);
  digitalWrite(M2, HIGH);
void back(char a, char b) {         //back
  analogWrite (E1, a);
  digitalWrite(M1, LOW);
  analogWrite (E2, b);
  digitalWrite(M2, LOW);
void turnLeft (char a, char b) {          //turn left
  analogWrite (E1, a);
  digitalWrite(M1, LOW);
  analogWrite (E2, b);
  digitalWrite(M2, HIGH);
void turnRight(char a, char b) {          //turn right
  analogWrite (E1, a);
  digitalWrite(M1, HIGH);
  analogWrite (E2, b);
  digitalWrite(M2, LOW);

void setup() {
  int i;
  for (i = 4; i <= 7; i++)
    pinMode(i, OUTPUT);
  Serial.begin(115200);   //serial1 baud rate for BT

void loop() {
  if (Serial.available() > 0) {
    char val =;

    if (val != NULL) {
      switch (val) {
        case 'w'://forward
          advance (100, 100);           break;
        case 's'://backward
          back (100, 100);          break;
        case 'a'://turn left
          turnLeft (100, 100);          break;
        case 'd'://turn right
          turnRight (100, 100);          break;
        case 'q'://stop
          stop();          break;
        default : break;
      val = NULL;

2 Diagram

(455.15 KiB) Downloaded 1497 times

3 Send command in three ways:

You can send "w,a,s,d,q" to control the car (motor) in these ways:

3.1 Through USB cable (not wireless):
If you connected the USB cable to PC, you can open arduino ide serial monitor, choose "115200".
(8.86 KiB) Downloaded 1497 times

3.2 Through another BLE device/PC:
Once you build connection between the Romeo BLE and another BLE module, you can use it as the controller to send command. Also, if you use PC, you can use serial monitor( you have to set the USBDEBUG ON by AT command).

3.3 Through you phone:
Once you installed the App, you can connect the Romeo BLE by the App and send command from the App.
(22.18 KiB) Downloaded 4011 times

If you met any question on connection or other problems, you can read here to check it out or leave a message here. :)