/
Exercises
Exercises
Exercise 1
- Read the light sensor continuously, once a second, and display/print it.
- make a sprite say/display it using the Live mode of mBlocks or
- print it on the serial console of Arduino IDE.
- Try both code and mBlocks!
- Whenever the light exceeds a certain threshold (you can set an appropriate threshold after reading the values), the buzzer should beep.
- You will have to take off the mBot cover for the light sensor to work well.
Exercise 2
- Read the line follower sensor and change the colour of RGB LEDs accordingly.
- 4 different colors for the 4 different scenarios encountered by the line follower sensor.
Exercise 3
- Read the ultrasonic sensors and control the motor accordingly
The threshold can be any reasonable value for now. We can tune this later.
Left Ultrasonic
Sensor
Right Ultrasonic
Sensor
Action Left Motor Right Motor < threshold < threshold Go forward turn forward turn forward < threshold > threshold Turn right turn forward stop > threshold < threshold Turn left stop turn forward > threshold > threshold Go back (you are lost!) turn backward turn backward * The above is a general idea. You should make refinements to the logic as well as thresholds for the actual competition