Question: Write a C program to control an autonomous robot. It runs on two wheels, each wheel connected to a DC motor. If both wheels run
Write a C program to control an autonomous robot. It runs on two wheels, each wheel connected to a DC motor. If both wheels run at the same speed, robot moves forward. If the right wheel runs slower, robot makes a right turn. There are two sensors mounted on the robot that can detect an obstacle, one in the front, one on the right.
Once the robot is turned on, it moves forward at 80% of the maximum possible speed. When an obstacle is detected in front, if there is nothing blocking on the right side; it slows down to 40% of maximum speed and then it makes a right turn. Unless there is an obstacle on the right side too, then the robot will stop.
You must use PWM to control the wheels. The sensor outputs are digital, the mbed board will detect low when no obstacle and will detect high, when there is an obstacle. This is pin connections for this robot.
Device mbed pin
Right wheel pin 21
Left wheel pin 22
Front sensor pin 10
Right sensor pin 11
Use a flowchart to show the algorithm of your program.

IN FS YV wait (o.) No yes E.S EN D IN FS YV wait (o.) No yes E.S EN D
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
