Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. const byte ledPin = 13;
  2. const byte interruptPin = 2;
  3. volatile byte state = LOW;
  4.  
  5. void setup() {
  6. pinMode(ledPin, OUTPUT);
  7. pinMode(interruptPin, INPUT_PULLUP);
  8. attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
  9. }
  10.  
  11. void loop() {
  12. digitalWrite(ledPin, state);
  13. }
  14.  
  15. void blink() {
  16. state = !state;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement