0% found this document useful (0 votes)
4 views1 page

Simple 7 Segment Program

The document contains an Arduino code that controls a common anode 7-segment display connected to pins 0-7. It sets up the pin modes for the display's segments and includes a loop that alternates turning the segments on and off with delays. The segments are activated for 500 milliseconds before switching off, followed by a 1-second pause.

Uploaded by

thanigai8614
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Simple 7 Segment Program

The document contains an Arduino code that controls a common anode 7-segment display connected to pins 0-7. It sets up the pin modes for the display's segments and includes a loop that alternates turning the segments on and off with delays. The segments are activated for 500 milliseconds before switching off, followed by a 1-second pause.

Uploaded by

thanigai8614
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

//Arduino pins from 0-7 are connected with a-g pins of common anode 7

segment display//
void setup()
{
// define pin modes
pinMode(6,OUTPUT); //pin6-a led
pinMode(7,OUTPUT); //pin7-b led
pinMode(8,OUTPUT); //pin8-c led
pinMode(9,OUTPUT); //pin9-d led
pinMode(10,OUTPUT); //pin10-e led
pinMode(11,OUTPUT); //pin11-f led
pinMode(12,OUTPUT); //pin12-g led
}
void loop()
{
// loop to turn leds of seven seg ON
for(int i=6;i<13;i++) //for_loop-1
{
digitalWrite(i, LOW); //digitalWrite(6-12,LOW);
delay(500); //500ms
}
//delay(1000); //1sec delay
// loop to turn leds of seven seg OFF
for(int i=6;i<13;i++) //for_loop-2
{
digitalWrite(i, HIGH); //digitalWrite(6-12,HIGH);
delay(500); //0.5 seconds
}
delay(1000); //1sec delay
}

You might also like