Components and supplies
7 Segment LED Display, InfoVue
Through Hole Resistor, 200 ohm
Arduino UNO
Tools and machines
10 Pc. Jumper Wire Kit, 5 cm Long
Breadboard, 170 Pin
Project description
Code
untitled
arduino
1int a=7; 2int b=6; 3int c=5; 4int d=11; 5int e=10; 6int 7 f=8; 8int g=9; 9int dp=4; 10//display number 1 11void display1(void) 12{ 13 14 digitalWrite(b,HIGH); 15 digitalWrite(c,HIGH); 16} 17//display number2 18void 19 display2(void) 20{ 21 digitalWrite(a,HIGH); 22 digitalWrite(b,HIGH); 23 24 digitalWrite(g,HIGH); 25 digitalWrite(e,HIGH); 26 digitalWrite(d,HIGH); 27} 28 29// display number3 30void display3(void) 31{ 32 digitalWrite(a,HIGH); 33 34 digitalWrite(b,HIGH); 35 36 digitalWrite(c,HIGH); 37 digitalWrite(d,HIGH); 38 39 digitalWrite(g,HIGH); 40} 41// display number4 42void display4(void) 43{ 44 45 digitalWrite(f,HIGH); 46 digitalWrite(b,HIGH); 47 digitalWrite(g,HIGH); 48 49 digitalWrite(c,HIGH); 50 51} 52// display number5 53void display5(void) 54 55{ 56 digitalWrite(a,HIGH); 57 digitalWrite(f,HIGH); 58 digitalWrite(g,HIGH); 59 60 digitalWrite(c,HIGH); 61 digitalWrite(d,HIGH); 62} 63// display number6 64void 65 display6(void) 66{ 67 digitalWrite(a,HIGH); 68 digitalWrite(f,HIGH); 69 70 digitalWrite(g,HIGH); 71 digitalWrite(c,HIGH); 72 digitalWrite(d,HIGH); 73 74 digitalWrite(e,HIGH); 75} 76// display number7 77void display7(void) 78 79{ 80 digitalWrite(a,HIGH); 81 digitalWrite(b,HIGH); 82 digitalWrite(c,HIGH); 83} 84 85// display number8 86void display8(void) 87{ 88 digitalWrite(a,HIGH); 89 90 digitalWrite(b,HIGH); 91 digitalWrite(g,HIGH); 92 digitalWrite(c,HIGH); 93 94 digitalWrite(d,HIGH); 95 digitalWrite(e,HIGH); 96 digitalWrite(f,HIGH); 97 98} 99void clearDisplay(void) 100{ 101 digitalWrite(a,LOW); 102 digitalWrite(b,LOW); 103 104 digitalWrite(g,LOW); 105 digitalWrite(c,LOW); 106 digitalWrite(d,LOW); 107 108 digitalWrite(e,LOW); 109 digitalWrite(f,LOW); 110} 111void display9(void) 112 113{ 114 digitalWrite(a,HIGH); 115 digitalWrite(b,HIGH); 116 digitalWrite(g,HIGH); 117 118 digitalWrite(c,HIGH); 119 digitalWrite(d,HIGH); 120 digitalWrite(f,HIGH); 121 122} 123void display0(void) 124{ 125 digitalWrite(a,HIGH); 126 digitalWrite(b,HIGH); 127 128 digitalWrite(c,HIGH); 129 digitalWrite(d,HIGH); 130 digitalWrite(e,HIGH); 131 132 digitalWrite(f,HIGH); 133} 134void setup() 135{ 136 int i; 137 for(i=4;i<=11;i++) 138 139 pinMode(i,OUTPUT); 140} 141void loop() 142{ 143 while(1) 144 145 { clearDisplay(); 146 display0(); 147 delay(2000); 148 clearDisplay(); 149 150 display1(); 151 delay(2000); 152 clearDisplay(); 153 display2(); 154 155 delay(2000); 156 clearDisplay(); 157 display3(); 158 159 delay(2000); 160 clearDisplay(); 161 display4(); 162 delay(2000); 163 164 clearDisplay(); 165 display5(); 166 delay(2000); 167 clearDisplay(); 168 169 display6(); 170 delay(2000); 171 clearDisplay(); 172 173 display7(); 174 delay(2000); 175 clearDisplay(); 176 display8(); 177 178 delay(2000); 179 clearDisplay(); 180 display9(); 181 182 delay(2000); 183 } 184}
untitled
arduino
1int a=7; 2int b=6; 3int c=5; 4int d=11; 5int e=10; 6int f=8; 7int g=9; 8int dp=4; 9//display number 1 10void display1(void) 11{ 12 digitalWrite(b,HIGH); 13 digitalWrite(c,HIGH); 14} 15//display number2 16void display2(void) 17{ 18 digitalWrite(a,HIGH); 19 digitalWrite(b,HIGH); 20 digitalWrite(g,HIGH); 21 digitalWrite(e,HIGH); 22 digitalWrite(d,HIGH); 23} 24// display number3 25void display3(void) 26{ 27 digitalWrite(a,HIGH); 28 digitalWrite(b,HIGH); 29 30 digitalWrite(c,HIGH); 31 digitalWrite(d,HIGH); 32 digitalWrite(g,HIGH); 33} 34// display number4 35void display4(void) 36{ 37 digitalWrite(f,HIGH); 38 digitalWrite(b,HIGH); 39 digitalWrite(g,HIGH); 40 digitalWrite(c,HIGH); 41 42} 43// display number5 44void display5(void) 45{ 46 digitalWrite(a,HIGH); 47 digitalWrite(f,HIGH); 48 digitalWrite(g,HIGH); 49 digitalWrite(c,HIGH); 50 digitalWrite(d,HIGH); 51} 52// display number6 53void display6(void) 54{ 55 digitalWrite(a,HIGH); 56 digitalWrite(f,HIGH); 57 digitalWrite(g,HIGH); 58 digitalWrite(c,HIGH); 59 digitalWrite(d,HIGH); 60 digitalWrite(e,HIGH); 61} 62// display number7 63void display7(void) 64{ 65 digitalWrite(a,HIGH); 66 digitalWrite(b,HIGH); 67 digitalWrite(c,HIGH); 68} 69// display number8 70void display8(void) 71{ 72 digitalWrite(a,HIGH); 73 digitalWrite(b,HIGH); 74 digitalWrite(g,HIGH); 75 digitalWrite(c,HIGH); 76 digitalWrite(d,HIGH); 77 digitalWrite(e,HIGH); 78 digitalWrite(f,HIGH); 79} 80void clearDisplay(void) 81{ 82 digitalWrite(a,LOW); 83 digitalWrite(b,LOW); 84 digitalWrite(g,LOW); 85 digitalWrite(c,LOW); 86 digitalWrite(d,LOW); 87 digitalWrite(e,LOW); 88 digitalWrite(f,LOW); 89} 90void display9(void) 91{ 92 digitalWrite(a,HIGH); 93 digitalWrite(b,HIGH); 94 digitalWrite(g,HIGH); 95 digitalWrite(c,HIGH); 96 digitalWrite(d,HIGH); 97 digitalWrite(f,HIGH); 98} 99void display0(void) 100{ 101 digitalWrite(a,HIGH); 102 digitalWrite(b,HIGH); 103 digitalWrite(c,HIGH); 104 digitalWrite(d,HIGH); 105 digitalWrite(e,HIGH); 106 digitalWrite(f,HIGH); 107} 108void setup() 109{ 110 int i; 111 for(i=4;i<=11;i++) 112 pinMode(i,OUTPUT); 113} 114void loop() 115{ 116 while(1) 117 { clearDisplay(); 118 display0(); 119 delay(2000); 120 clearDisplay(); 121 display1(); 122 delay(2000); 123 clearDisplay(); 124 display2(); 125 delay(2000); 126 clearDisplay(); 127 display3(); 128 delay(2000); 129 clearDisplay(); 130 display4(); 131 delay(2000); 132 clearDisplay(); 133 display5(); 134 delay(2000); 135 clearDisplay(); 136 display6(); 137 delay(2000); 138 clearDisplay(); 139 display7(); 140 delay(2000); 141 clearDisplay(); 142 display8(); 143 delay(2000); 144 clearDisplay(); 145 display9(); 146 delay(2000); 147 } 148}
Downloadable files
uno_OUJjF62NS2.jpg
uno_OUJjF62NS2.jpg
uno_OUJjF62NS2.jpg
uno_OUJjF62NS2.jpg
Comments
Only logged in users can leave comments