Line: 1 to 1 | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Controlling the DC motorsThe motors cannot be driven by the Arduino PWM outputs directly but they must pass through a motor driver boosting the signal power In our case an L298N![]() ![]() | |||||||||||||
Changed: | |||||||||||||
< < |
| ||||||||||||
> > |
| ||||||||||||
3,5,6,9,11 | |||||||||||||
Added: | |||||||||||||
> > | The IN1-IN4 pins define the direction of the movement and the EN pin, which is a PWM signal, controls the speed. Then controlling the robot through Bluetooth then the PWM pins allow me to have values between 0 and 255. However, the motors need a certain current before they start moving. Since the motor values sent through the protocol are 9 bits (10 bit ADC on the Arduino but forward and backward on a single joystick potentiometer) I shift the forward or backward value by 1 bit and I and it with 0xC0. After that I add the left/right value shifted right by 2 bits which should allow me to increase the speed of one wheel with respect to the other and thus turn left or right. | ||||||||||||
-- ![]() Comments\ No newline at end of file |