Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Next »

Task

Create a program such that the motor rotates clockwise at the maximum speed when the distance from an obstacle is less than 30cm, and rotates anticlockwise at half the maximum speed when the distance from the obstacle is greater than or equal to 30cm

Hints

  • Combine the codes and circuits in slides 3 and 10, and use an if condition.
  • analogWrite() with values 255,0 (dir1speed,dir2speed) and 0,128 respectively can be used for clockwise and anticlockwise rotation. The speed is not perfectly linearly related to the value (duty cycle), and that is ok for this exercise.

Solution

Easy to do, solution will not be provided.


  • No labels