Temp-4-2

From ArduinoInfo
Jump to: navigation, search
/*
  Alternate Blink
  Turns on one LED on for one second while the other is off, then reverses the
  LEDs for 1 second, repeatedly.

  Dr. Purdum, Dec. 15, 2014
  */
/*-----( Import needed libraries )-----*/
// None Yet
/*-----( Declare Constants and Pin Numbers )-----*/
// Give each LED a name:
const int LED1 = 10;
const int LED2 = 11;
/*-----( Declare objects )-----*/
// None Yet
/*-----( Declare Variables )-----*/
long counter = 0;

void setup()   /****** SETUP: RUNS ONCE ******/
{
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
}//--(end setup )---

void loop()   /****** LOOP: RUNS CONSTANTLY ******/
{
  if (counter % 2 == 1)
  {
    digitalWrite(LED1, LOW);     // turn LED off by making the voltage LOW
    digitalWrite(LED2, HIGH);    // turn LED on (HIGH is the voltage level)
    delay(1000);                 // wait for a second
  }
  if (counter % 2 == 0)
  {
    digitalWrite(LED1, HIGH);    // turn LED on (HIGH is the voltage level)
    digitalWrite(LED2, LOW);     // turn LED off by making the voltage LOW
    delay(1000);                 // wait for a second
  }
  counter = counter + 1;
}//--(end main loop )---