Tuesday, May 29, 2012

Final Code

This is the final code for the robot.



The code proceeds as such:
1.       Block 1 contains the code to lower the front ram into place (allowing the bot to expand)
2.       The next section is a loop which is on infinite loop that repeats the actions until the end of the match
3.       The inner code is split into 3 sensor switches
a.       Light 1: this code deals with the front light sensor that is meant to stop the bot from driving off the edge once it has pushed the enemy off the ledge
b.      Light 2: this code deals with the rear light sensor that is meant to enact a avoidance code
                                                               i.      First motion block turns backwards to change the approaching angle
                                                             ii.      Second motion block turns at an angle forward to further change the angle of the opponent
c.       Distance 1: this code deals with the ultrasonic sensor  and act as an if/if not statement
                                                               i.      If the opponent is within the area then it will move toward it
                                                             ii.      It the opponent is outside of the are then it will turn to and search
[distance is 30cm]

No comments: