
© Royalty Free/Corbis
Exercise 1
Exercise 2
Exercise 3
/* Blinking LED without using delay*/
// LED should be the pin connected to an LED
int ledPin = ___;
// set value to the state of the LED before the program runs
int value = ___;
// store last time LED was updated
long previousMillis = 0;
// interval at which to blink (milliseconds)
long interval = _____;
void setup(){
// sets the digital pin as output
_____________
}
void loop(){
// check to see if the difference between the current time and
//last time we blinked the LED bigger than
// the interval at which you want to blink the LED.
if (millis() - previousMillis > interval) {
// remember the last time you blinked the LED
//by setting previousMillis to millis()
_________________
// if the LED is off turn it on and vice-versa.
if (value == LOW){
value = ___;
}else{
value = ____;
}
digitalWrite(ledPin, value);
}
}