Monday, June 5, 2017
Common Anode Seven-Segment Display Test
// 7 Segment test
void setup()
{
// define pin modes
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
}
void loop()
{
for(int i=6;i<13;i++) //Clear LEDs since the outputs start LOW (LED ON)
{
digitalWrite(i,HIGH);
delay(1);
}
// loop to turn leds segments ON by sinking them (taking pins to GND)
for(int i=6;i<13;i++)
{
digitalWrite(i,LOW);
delay(600);
}
// loop to turn leds segnemts OFF by taking the pins to V+
for(int i=6;i<13;i++)
{
digitalWrite(i,HIGH);
delay(600);
}
delay(1000);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment