This content features Bluetooth communication with an Arduino 2WD car. Assemble the car using an ESP32 DevKit V1, TB6612FNG driver, 2WD chassis, breadboard, M-F/M-M cables, battery holder, 18650 batteries, and a switch. Then, upload this sample code to the ESP32.
The code drives two DC motors via Bluetooth (Classic BT) using commands: F (Forward), B (Backward), L (Left), R (Right), and S (Stop). Each movement automatically stops after 300–400ms.
C++
void loop() {
if (SerialBT.available()) {
char command = SerialBT.read();
Serial.println(command);
if (command == 'F') { moveForward(); delay(400); stopMotors(); }
else if (command == 'B') { moveBackward(); delay(400); stopMotors(); }
else if (command == 'L') { turnLeft(); delay(325); stopMotors(); }
else if (command == 'R') { turnRight(); delay(325); stopMotors(); }
else if (command == 'S') { stopMotors(); }
}
}
The car operates once you add the specific motor control functions to this loop and upload it to the ESP32.
1. Select 1 of the 10 available maps.
2. Connect Bluetooth via the Options tab.
3. Controls: A (Reverse), B (Forward), Y (Right), X (Left), Right Joystick Click (View Camera).
4. Complete 5 laps to unlock autonomous driving.
| Mixed reality | |
| comfort | ⦾ Comfortable |
| age rating | 0+ Everyone |
| storage | 0.3 GB |
| website | training.contentsda.kr |
| developer | ContentsDaInc |
| publisher | ContentsDA Inc. |
| connection | Internet not required |
| app version | 1.0 |
| languages |
English
|