Completed the code for the bot
Here’s all I did:
-
Set up BluetoothSerial.h so the robot can connect wirelessly to my phone under the name “Abyss Titan”.
-
Mapped out the pins for the motor drivers (19, 21, 22, 23) and the RGB LED (25, 26, 27).
-
Instead of using basic analogWrite, I used the ESP32’s hardware PWM channels (ledcSetup and ledcAttachPin) at 5000Hz to make the motor movements smooth and stop any weird high-pitched whining noises.
-
Programmed a speed control system: Button 1 sets speed to 120 (Blue LED), Button 2 sets it to 200 (Green LED), and Button 3 triggers Turbo Mode at max 255 speed (Purple LED).
-
Wrote all the driving functions for full movement: forward, backward, left, right, and stop. Also added diagonal turning functions (forward_right, backward_left, etc.) so the robot can make smoother adjustments while driving.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.