const int pinone = 13;
int ledState = LOW; // the switch which sould vary with the program later
int previousMillis = 0;
int interval = 1000; // the two variables are used for algoritm later?
void setup() {// the setup part runs one
pinMode(pinone, OUTPUT); /*set the variable pineone as an output.
pinone has an integer constant value of 13 which is what
the arduion takes as the hardware pin number */
}
void loop() {
//algorithm:
// check to see if it's time to blink the LED; that is, if the
// difference between the current time and last time you blinked
// the LED is bigger than the interval at which you want to
// blink the LED.
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > 800) {
// save the last time you blinked the LED
previousMillis = millis();
// if the LED is off turn it on and vice-versa:
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
// set the LED with the ledState of the variable:
digitalWrite(pinone, ledState);
}
}