Created
December 4, 2010 18:35
-
-
Save dz0ny/728378 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 <EEPROM.h> | |
int luc = 13; | |
volatile int stanjeLuci = LOW; | |
void setup() | |
{ | |
pinMode(luc, OUTPUT); | |
stanjeLuci = EEPROM.read(88); // pač naslov možno je od 0 do 255 | |
digitalWrite(luc, stanjeLuci); | |
attachInterrupt(0, spremeniluc, RISING);// ob sprembi ko gre iz 0 v 1 | |
} | |
void loop() | |
{ | |
} | |
void spremeniluc() | |
{ | |
stanjeLuci = !stanjeLuci; //spremnim stanje | |
digitalWrite(luc, stanjeLuci); //takoj posodobim stanje, ker se loop trenutno ne izvaja | |
EEPROM.write(88, stanjeLuci); | |
delay(300); // cakam 300ms aka debounce filter | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment