Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int led = 13;
- int outputLed = 2;
- int interruptPin = 3;
- volatile byte flag = LOW;
- void pinChange ()
- {
- flag = !flag;
- digitalWrite (outputLed, flag);
- }
- void setup ()
- {
- pinMode (led, OUTPUT);
- pinMode(outputLed, OUTPUT);
- pinMode(interruptPin, INPUT_PULLUP);
- digitalWrite (outputLed, flag);
- attachInterrupt (digitalPinToInterrupt(interruptPin), pinChange, FALLING);
- }
- void loop ()
- {
- digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
- delay(1000); // wait for a second
- digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
- delay(1000); // wait for a second
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement