7 Segment
Rangkaian Dengan Proteus 8
Source code Arduino
//7 segment1 int a=0,b=1, c=2, d=3, e=4, f=5,g=6; //7 segment2 int aa=7, bb=8, cc=9, dd=10,ee=11,ff=12,gg=13; void setup() { //7 segment 1 pinMode(a,OUTPUT); pinMode(b,OUTPUT); pinMode(c,OUTPUT); pinMode(d,OUTPUT); pinMode(e,OUTPUT); pinMode(f,OUTPUT); pinMode(g,OUTPUT); //7 segment 2 pinMode(aa,OUTPUT); pinMode(bb,OUTPUT); pinMode(cc,OUTPUT); pinMode(dd,OUTPUT); pinMode(ee,OUTPUT); pinMode(ff,OUTPUT); pinMode(gg,OUTPUT); } void loop() { //kondisi 1 ==>> 00 //7Segments 1 digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,1); //7Segments 2 digitalWrite(aa,0); digitalWrite(bb,0); digitalWrite(cc,0); digitalWrite(dd,0); digitalWrite(ee,0); digitalWrite(ff,0); digitalWrite(gg,1); delay(1000); //kondisi 1 ==>> 11 //7Segments 1 digitalWrite(a,1); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,1); digitalWrite(e,1); digitalWrite(f,1); digitalWrite(g,1); //7Segments 2 digitalWrite(aa,1); digitalWrite(bb,0); digitalWrite(cc,0); digitalWrite(dd,1); digitalWrite(ee,1); digitalWrite(ff,1); digitalWrite(gg,1); delay(1000); //kondisi 1 ==>> 22 //7Segments 1 digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,1); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,1); digitalWrite(g,0); //7Segments 2 digitalWrite(aa,0); digitalWrite(bb,0); digitalWrite(cc,1); digitalWrite(dd,0); digitalWrite(ee,0); digitalWrite(ff,1); digitalWrite(gg,0); delay(1000); //kondisi 1 ==>> 33 //7Segments 1 digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,1); digitalWrite(f,1); digitalWrite(g,0); //7Segments 2 digitalWrite(aa,0); digitalWrite(bb,0); digitalWrite(cc,0); digitalWrite(dd,0); digitalWrite(ee,1); digitalWrite(ff,1); digitalWrite(gg,0); delay(1000); //kondisi 1 ==>> 44 //7Segments 1 digitalWrite(a,1); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,1); digitalWrite(e,1); digitalWrite(f,0); digitalWrite(g,0); //7Segments 2 digitalWrite(aa,1); digitalWrite(bb,0); digitalWrite(cc,0); digitalWrite(dd,1); digitalWrite(ee,1); digitalWrite(ff,0); digitalWrite(gg,0); delay(1000); //kondisi 1 ==>> 55 //7Segments 1 digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,1); digitalWrite(f,0); digitalWrite(g,0); //7Segments 2 digitalWrite(aa,0); digitalWrite(bb,1); digitalWrite(cc,0); digitalWrite(dd,0); digitalWrite(ee,1); digitalWrite(ff,0); digitalWrite(gg,0); delay(1000); //kondisi 1 ==>> 66 //7Segments 1 digitalWrite(a,0); digitalWrite(b,1); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); //7Segments 2 digitalWrite(aa,0); digitalWrite(bb,1); digitalWrite(cc,0); digitalWrite(dd,0); digitalWrite(ee,0); digitalWrite(ff,0); digitalWrite(gg,0); delay(1000); //kondisi 1 ==>> 77 //7Segments 1 digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,1); digitalWrite(e,1); digitalWrite(f,1); digitalWrite(g,1); //7Segments 2 digitalWrite(aa,0); digitalWrite(bb,0); digitalWrite(cc,0); digitalWrite(dd,1); digitalWrite(ee,1); digitalWrite(ff,1); digitalWrite(gg,1); delay(1000); //kondisi 1 ==>> 88 //7Segments 1 digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,0); digitalWrite(f,0); digitalWrite(g,0); //7Segments 2 digitalWrite(aa,0); digitalWrite(bb,0); digitalWrite(cc,0); digitalWrite(dd,0); digitalWrite(ee,0); digitalWrite(ff,0); digitalWrite(gg,0); delay(1000); //kondisi 1 ==>> 99 //7Segments 1 digitalWrite(a,0); digitalWrite(b,0); digitalWrite(c,0); digitalWrite(d,0); digitalWrite(e,1); digitalWrite(f,0); digitalWrite(g,0); //7Segments 2 digitalWrite(aa,0); digitalWrite(bb,0); digitalWrite(cc,0); digitalWrite(dd,0); digitalWrite(ee,1); digitalWrite(ff,0); digitalWrite(gg,0); delay(1000); }
Comments
Post a Comment