This robot was pretty neat, I thought it was rather humorous too. The point of the robot was to give out high-fives. The three states are rest, standby and high-fiving. There are two IR sensors in the system. One of them detects if anyone is near and another detects if a hand is in position for a high-five. The three states are determined by these two IR sensors.
When no one is near either sensor, the system is in rest state, where the hand is stretched out parallel to the floor. When someone is near the system (triggering one IR sensor), the hand raises up and is in standby mode. At this point, it is waiting to get a high-five. When you put your hand next to the robot’s hand, it will trigger the second IR sensor and slap your hand.
Arduino Sketch: High-Five Robot!