Seven Segments display and the multiplexing display strategy
If you need additional specific information about this topic or if you want to look it personally please write an email
int pin1 = 2;
int pin2 = 3;
int pin3 = 4;
int pin4 = 5;
int pin5 = 6;
int pin6 = 7;
int pin7 = 8;
int gnd1 = 11;
int gnd2 = 9;
int timer = 1000;
Now, in the setup function you need to initialise any single digital pin using the pinmode command:
ipinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pin4, OUTPUT);
pinMode(pin5, OUTPUT);
pinMode(pin6, OUTPUT);
pinMode(pin7, OUTPUT);
pinMode(gnd1, OUTPUT);
pinMode(gnd2, OUTPUT);
Now, simply switching the two ground pins (setting them true and false in an intervall of 0.5 ms), you will see the refresh effect and your eyes will see a number of 2 digits displayed for 2 seconds (1000 * 0,5)
//this represents the number "20"
for (int i=0; i=timer-1; i++){
digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B0);
digitalWrite(pin4, B1);
digitalWrite(pin5, B0);
digitalWrite(pin6, B1);
digitalWrite(pin7, B1);
digitalWrite(gnd1, B0);
digitalWrite(gnd2, B1);
delay(0.5);
digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B1);
digitalWrite(pin4, B0);
digitalWrite(pin5, B1);
digitalWrite(pin6, B1);
digitalWrite(pin7, B1);
digitalWrite(gnd1, B1);
digitalWrite(gnd2, B0);
delay(0.5);
}
This example is very easy to understand but does nothing more than a display. However, it is very useful in order to understand the concept of multiplexing and how to use same pins to drive different digits. Following this example you can immediately: