Code Guide

  1. When the program starts, the robot moves forward with the gripper open. (Going to collect object)
  2. When the hand is placed above IR sensor robot must stop and close the gripper. (Collecting object)
  3. When the hand is raised again robot moves forward with the closed gripper. (Moving with collected object)
  4. When the hand is placed above the IR sensor again, the robot stops and opens the gripper. (Dropping object)
  5. Return to 1.
Pseudocode:

on start
    close gripper

loop

    read IR sensor value

    if IR == LOW

turn off motors

if gripper is open
close griper
else if gripper is closed
open gripper

wait 3 seconds

else

turn on motors

end if;

end loop;