Introduction: The Fearful Robot

The Fearful Robot
The Fearful Robot is scared of being in the dark. As the room gets darker you can see his heart beat faster and faster. When it gets to dark the robot flat lines it. Turn on the lights to calm him down or bring him back to life.

Components Needed:

1x Stuffed Animal
1x Breadboard
1x Arduino
3x LED's
1x 100 or 220 Ohm Resistor
3x 220 Ohm Resistors
1x 10K Resistor
1x LDR
1x Speaker or Piezo Buzzer
Wires

Components can be found at http://egrobotics.com/store/
This Project uses and Arduino Board and LDR Add-on Kit

www.EGRobotics.com

The Code:

int flashrate = 0;
void setup() {
  pinMode(13, OUTPUT);
  delay(2000);
}
void loop() {
void loop() {  int sensorValue = analogRead(A0);
  int flashrate = sensorValue * .9;
      if (sensorValue > 80 ) {
analogWrite(3, 150);   
digitalWrite(13, HIGH);
delay(30);
  digitalWrite(3, LOW);
  delay(flashrate);
  digitalWrite(13, LOW);
  delay(flashrate);
      }
    if (sensorValue < 80 ) {
    analogWrite(3, 150);
    digitalWrite(13, LOW);
  }
  }

Video:


Go to www.instructables.com/member/EGRobotics/ for more fun projects!

Comments

author
amandaghassaei made it!(author)2012-09-25

very cute, I'm glad he can be easily resuscitated!

About This Instructable

780views

3favorites

License:

More by EGRobotics:Electronic Christmas Tree OrnamentSimple Electric MotorElectric Generator Powering LEDs
Add instructable to: