/*
SparkFun Inventor’s Kit
Circuit 1A-Blink
Turns an LED connected to pin 13 on and off. Repeats forever.
This sketch was written by SparkFun Electronics, with lots of help from the Arduino community.
This code is completely free for any use.
View circuit diagram and instructions at: https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-experiment-guide---v41
Download code at: https://github.com/sparkfun/SIK-Guide-Code
*/
boolean kveikt = false;
void setup() {
pinMode(8, OUTPUT); // Set pin 13 to output
pinMode(7, INPUT_PULLUP);
}
void loop() {
if(digitalRead(7) == LOW) { //Spurning: er verið að styðja á takka?
if(kveikt == true) { //Spurning: er slökkt á leddu
digitalWrite(8, LOW);
kveikt = false;
delay(250);
}
else {
digitalWrite(8, HIGH); //kveikja á leddu
kveikt = true; //munum að það er kveikt á leddu
delay(250);
}
}
}