Difference between revisions of "5 Display numbers on Seven Segment Display"
(4 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
/* | /* | ||
− | Display 0 to 9 on 7Segment Display. | + | Display 0 to 9 Numbers on 7Segment Display. |
*/ | */ | ||
− | |||
− | |||
// give it a name: | // give it a name: | ||
int a = 2; | int a = 2; | ||
Line 122: | Line 120: | ||
} | } | ||
− | <syntaxhighlight> | + | </syntaxhighlight> |
+ | =Demo Video= | ||
+ | {{#ev:youtubehd|jFxi2i4laNs|640}} | ||
+ | {{DISQUS}} |
Latest revision as of 12:08, 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