Skip to content

Instantly share code, notes, and snippets.

@dz0ny
Created December 4, 2010 18:35
Show Gist options
  • Save dz0ny/728378 to your computer and use it in GitHub Desktop.
Save dz0ny/728378 to your computer and use it in GitHub Desktop.
#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