Note

Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.

Why Join?

  • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.

  • Learn & Share: Exchange tips and tutorials to enhance your skills.

  • Exclusive Previews: Get early access to new product announcements and sneak peeks.

  • Special Discounts: Enjoy exclusive discounts on our newest products.

  • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.

👉 Ready to explore and create with us? Click [here] and join today!

4. Drift¶

In this project, you will learn how to make the Zeus Car drift.

../_images/zeus_drift_left.jpg

How to do?

  1. The ESP32-CAM and the Arduino board share the same RX (receive) and TX (transmit) pins. So, when you’re uploading code, you’ll need to first disconnect the ESP32-CAM to avoid any conflicts or potential issues.

    ../_images/unplug_cam1.png
  2. Open the 4_drift.ino file under the path of zeus-car-main\examples\4_drift.

  3. After the code is uploaded successfully, slide the power switch to ON to start the Zeus Car.

  4. Zeus Car will now move forward for 0.5 seconds, then drift 90 degrees left, and so forth. You can try changing 45 (rot) to another value or a negative number to see how the drift angle and direction change.

How it works?

The drift of the Zeus Car is achieved by adding the drift parameter drift to the move function carMove().

void carMove(int16_t angle, int8_t power, int8_t rot, bool drift)
  • angle: The direction you want the car to move. use the head of the car as the 0 degree and increase the angle in counterclockwise direction.

  • power: The moving power, the range is -100% ~ 100%. When power is positive, the car moves forward, and vice versa, it moves backward.

  • rot: Rotation power, the range is -100% ~ 100%. When rot is positive, the car turn counterclockwise, and vice versa.

  • drift: Default is false, when it is true, drift mode is enabled.

So the different power and rot values will change the drift angle and direction of the Zeus Car.