Lab Homework 1
Due Friday, April 18, in the Lab
You must write an event-based implementation of a robot that seeks the light. The strategy the robot uses is up to you. You need to use an event-based implementation; in particular, I recomment developing the state machine first. You can then translate the state machine into C code following this example. You can look at this simple example of use of the light sensor. Note that your state machine can use:
- Global variables: you can assign to these variables as you take transitions, and you can use these variables in setting your decisions on when to wake up (when to receive an event). For example, you can store the light values you read as global variables.
- You can modify the nap function so that not only timeouts and bumps, but also light values, wake you up.
You need to turn in the following:
- A state diagram of your code (on paper).
- The code of your robot (email it to me).
- You need to demo the robot on Friday.
Your assignment will be graded on the basis of:
- The state machine: how elegant, well-designed it is.
- The code: how clear and well-written it is.
- The robot: how well it manages to seek the light, and how well it reacts to a changing external environment.
Good luck!
