Created
May 3, 2015 14:01
-
-
Save busti/747ed0daa89d3de23ef7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "avr/interrupt.h" | |
int inPin = 3; | |
int outPin = 4; | |
volatile boolean state = false; | |
void setup() { | |
pinMode(inPin, INPUT); | |
digitalWrite(inPin, HIGH); | |
pinMode(outPin, OUTPUT); | |
GIMSK = 0b00100000; // turns on pin change interrupts | |
PCMSK = 0b00001000; // turn on interrupts on pin PB3 | |
sei(); | |
} | |
void loop() { | |
} | |
ISR(PCINT0_vect) { | |
digitalWrite(outPin, digitalRead(inPin)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment