Order to write simple code on Arduino
The platform must have the ability to drive forward and backward on the rail and the proximity sensors should weaken the PWM signal that the Arduino gets and goes out with a weakened signal to the ESC controller and then to the brushless motor.
- proximity sensors are installed at the front and rear of the platform
- the PWM signal is received after the RC receiver
- the PWM signal from the receiver goes to pin 6 of the Arduino
- PWM signal weakened which is to go to ESC goes out on pin 9 of Arduino
- Echo signal of the first sensor is pin 3
- Trig signal of the first sensor is pin 2
- Echo signal of the second sensor is pin 5
- Trig signal of the second sensor is pin 4
From a distance of 50cm when the sensor looks out an obstacle in front of it until it approaches 20cm, the signal should be weakened all the way to zero in the direction in which the platform is traveling. After exceeding the distance of 20cm, the platform should continue to not allow driving in that direction. Proximity sensors should act as limiters, but the closer to the obstacle the speed in that direction should be weakened. On the other side of the platform if there is no obstacle in front of it, the vehicle should be able to drive in the opposite direction without any problem until the obstacle is detected and the signal is weakened as before.