Final Blog – TaoWang
Final Blog – Robot State Machine and Debugging Reflection In the final stage of this project, my main work was focused on understanding and implementing the control logic of the robot using a state machine approach. The robot used distance sensor inputs through the ADC channels, and these sensor readings were then used to decide how the two motors should move. The basic idea was that the robot should be able to search for a target, detect when the target is present, move towards it, and correct its direction if the target is more clearly detected on the left or right side. The final program was based on a PIC16F877A microcontroller running with CCS RTOS. The system was divided into several tasks. One task was responsible for reading the ADC values from the distance sensors. Two output tasks were responsible for generating PWM signals for the two motors. Another task worked as the state machine, which decided the next movement of the robot according to the sensor condition. This structu...