// Identify LED pins
const int ledPinA = 2;
const int ledPinB = 3;
const int ledPinC = 4;
const int ledPinD = 5;
const int ledPinE = 6;
const int ledPinG = 7;
const int ledPinF = 8;
void setup() {
// put your setup code here, to run once:
// setting up the pins as outputs using a for loop
for(int i=2; i<9; i++)
{
pinMode(i, OUTPUT);
}
}
void loop() {
// put your main code here, to run repeatedly:
// Turn off all LEDs using a for loop
for(int i=2; i<9; i++)
{
digitalWrite(i, HIGH);
}
delay(1000);
// Display 0
digitalWrite(ledPinA , LOW);
digitalWrite(ledPinB , LOW);
digitalWrite(ledPinC , LOW);
digitalWrite(ledPinD , LOW);
digitalWrite(ledPinE , LOW);
digitalWrite(ledPinF , LOW);
delay(1000);
// Turn off all LEDs using a for loop
for(int i=2; i<9; i++)
{
digitalWrite(i, HIGH);
}
// Display 1
digitalWrite(ledPinB , LOW);
digitalWrite(ledPinC , LOW);
delay(1000);
// Turn off all LEDs using a for loop
for(int i=2; i<9; i++)
{
digitalWrite(i, HIGH);
}
}