14 June, 2010

My alarm clock

I have tested using a transistor to power a loud speaker louder than what the arduino can do itself. Here is the code I made it's very simple.  I simple set it on with the reset button and 8 hours later its time to get up.


unsigned long time = 28800000; // this is eight hours in ms (1000*60*60*8)
int alarm = 12;  //the toneMeoldy library is udes so that the speaker makes a noise audible to human ear


void setup(){
  pinMode (alarm, OUTPUT);
}
void loop(){
  delay(time);
  digitalWrite(alarm, HIGH);
}

No comments:

Post a Comment