the shy rabbit has 3 states:
1. approach and avoid:
the IR sensor detects certain distance range. if someone invades the rabbit’s territory, the servo motor rotates at a random angle while the turning direction is based on current position, resulting in an ignore behavior.
2. kiss and blush:
the photo sensor detects certain threshold. if someone kisses the rabbit on the cheek, namely, covers the photo sensor, the LEDs start pulsing like a blush.
3. touch and nervous:
the tilt sensor acts as a switch. if someone touch the rabbit by bending its ear, the DC motor starts rotating like a shivering tail.
the states are basically independent, although my intention was to make it behave differently according to proximity.
materials include tilt sensor, photo sensor, IR sensor, DC motor, servo motor, LEDs, resisters, TIP 120, batteries… i did this intentionally to practice most of what we’ve covered in class.
jumpers are annoying ：(
Arduino Sketch: Wu_shy rabbit