Difference between revisions of "5 Display numbers on Seven Segment Display"
m (Sandeep moved page 5 Read switch and count on Seven Segment Display to 5 Display numbers on Seven Segment Display) |
|||
Line 119: | Line 119: | ||
delay(500); | delay(500); | ||
} | } | ||
+ | =Demo Video= | ||
+ | {{#ev:youtubehd|jFxi2i4laNs|640}} | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 12:07, 19 September 2014
Code
/* Display 0 to 9 Numbers on 7Segment Display. */ // give it a name: int a = 2; int b = 3; int c = 4; int d = 5; int e = 6; int f = 7; int g = 8; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(a, OUTPUT); pinMode(b, OUTPUT); pinMode(c, OUTPUT); pinMode(d, OUTPUT); pinMode(e, OUTPUT); pinMode(f, OUTPUT); pinMode(g, OUTPUT); } // the loop routine runs over and over again forever: void loop() { //Disply 0 digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); digitalWrite(g, LOW); delay(500); //Disply 1 digitalWrite(a, LOW); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, LOW); digitalWrite(e, LOW); digitalWrite(f, LOW); digitalWrite(g, LOW); delay(500); //Disply 2 digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, LOW); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, LOW); digitalWrite(g, HIGH); delay(500); //Disply 3 digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, LOW); digitalWrite(f, LOW); digitalWrite(g, HIGH); delay(500); //Disply 4 digitalWrite(a, LOW); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, LOW); digitalWrite(e, LOW); digitalWrite(f, HIGH); digitalWrite(g, HIGH); delay(500); //Disply 5 digitalWrite(a, HIGH); digitalWrite(b, LOW); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, LOW); digitalWrite(f, HIGH); digitalWrite(g, HIGH); delay(500); //Disply 6 digitalWrite(a, HIGH); digitalWrite(b, LOW); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); digitalWrite(g, HIGH); delay(500); //Disply 7 digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, LOW); digitalWrite(e, LOW); digitalWrite(f, LOW); digitalWrite(g, LOW); delay(500); //Disply 8 digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, HIGH); digitalWrite(f, HIGH); digitalWrite(g, HIGH); delay(500); //Disply 9 digitalWrite(a, HIGH); digitalWrite(b, HIGH); digitalWrite(c, HIGH); digitalWrite(d, HIGH); digitalWrite(e, LOW); digitalWrite(f, HIGH); digitalWrite(g, HIGH); delay(500); } =Demo Video= {{#ev:youtubehd|jFxi2i4laNs|640}}