A simple FSM controls the direction of a micro-robot based on sensors placed around the robot. The speed is driven by a PWM signal with an 8-bit resolution that can be set through input pins when the RESET pin is active.
The design also supports the use of an H bridge to allow the motors bidirectional rotation.
After reset, the PWM value should be setted by the input pins and the signal is on one of the output pins for testing. Experiment by changing the inputs to change the states of the FSM and the motor directions.
# | Input | Output | Bidirectional |
---|---|---|---|
0 | motor B left | pwm resolution bit 0 | |
1 | motor B Right | pwm resolution bit 1 | |
2 | motor A Left | pwm resolution bit 2 | |
3 | motor A Right | pwm resolution bit 3 | |
4 | 0 | pwm resolution bit 4 | |
5 | Front sensor | 0 | pwm resolution bit 5 |
6 | Left sensor | 0 | pwm resolution bit 6 |
7 | Rigt sensor | pwm signal | pwm resolution bit 7 |