# How to code your own electric car and enjoy the drive

How to code automatic line-following programs

The electric tram quietly bursts into flames. Compared with traditional gasoline-powered cars, it boasts features like quick acceleration and zero emissions. To help drivers adapt swiftly, most electric trams have adopted driving techniques from automatic transmission gasoline cars. Have you ever considered creating your own program to simulate car driving? Following this # How to, you can design and complete programs for the tram's cockpit and the control system of the small car chassis.

Quad RGB SensorQuad RGB Sensor

P - Park: This mode locks the transmission, preventing the vehicle from moving. It's used when the car is stationary and parked.
R - Reverse: When in Reverse, the car moves backward. It's used for backing up.
N - Neutral: Neutral disengages the transmission from the engine. The car can roll freely without the engine's power affecting it. It's used when the car needs to be pushed or towed.
D - Drive: In Drive, the car moves forward. This is the mode for normal driving. The transmission will automatically shift through the gears as needed for optimal performance and fuel efficiency.

Program Functions Completed

--Completed Steering Wheel Design: Used for controlling the car‘s direction and featuring a self-centering function, just like in reality.
--Completed Gear Shift Design: Allows for changing the car's forward and reverse gears.
--Completed Accelerator Pedal Design: Clicking the accelerator pedal increases the car's speed and includes a standard speed setting.
--Completed Brake Pedal Design: Clicking the brake pedal reduces the car's speed.

Materials Required

Quad RGB Sensor

It is recommended for beginners to use a computer for programming and a mobile device for running programs.

Edit the interactive interface and control the ‘car’

All the materials used in the project can be customized, allowing you to design your own driver's compartment.

base_power: Approximate forward speed kp: Adjustment value for left and right wheels during line following left_power: Actual speed of the left wheel right_power: Actual speed of the right wheelQuad RGB SensorQuad RGB Sensor
Quad RGB Sensor
Liquid error (sections/pf-9ede269f line 81): product form must be given a product
×

Request for Quote

Quotation Notice

1. An email has been sent to you containing the quotation file and all other important files. Please check your mailbox.
2. The quote is valid for 30 days. Please generate your Purchase Order within this period. If the quote expires, a new quote will need to be generated.

Download W9

Download W9

More Support

If you need more help, kindly mail to vendor: us@makeblock.com