/
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

      ActionLeft MotorRight Motor
      < threshold< thresholdGo forwardturn forwardturn forward 
      < threshold> thresholdTurn rightturn forwardstop
      > threshold< thresholdTurn leftstopturn forward
      > threshold> thresholdGo back (you are lost!)turn backwardturn backward 

      * The above is a general idea. You should make refinements to the logic as well as thresholds for the actual competition

Related content

Find The Cheese
Find The Cheese
Read with this
mBot
mBot
More like this
Workshop Programme
Workshop Programme
Read with this
Exercise 4
Exercise 4
More like this
Challenges
Challenges
More like this
Exercise 4 Solution
Exercise 4 Solution
More like this