Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. void setup()
  2. {
  3. pinMode(13,OUTPUT);
  4. pinMode(12,INPUT);
  5. }
  6.  
  7. void loop()
  8. {
  9. if (digitalRead(12) == HIGH) // this will activate ONLY IF pin 12 is HIGH
  10. {
  11. digitalWrite(13,HIGH);
  12. delay(map(analogRead(A0),0,1023,0,600000)); // delayed based off POT value
  13. digitalWrite(13,LOW);
  14. delay(map(analogRead(A0),0,1023,0,600000)); // same as above, except delayed in the off position - this will give time to turn phone or alarm off!
  15. }// will loop back to top of if statement and will not start again until pin 12 is high
  16. else
  17. {
  18. digitalWrite(13,LOW);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement