Présentation l'afficheur 7 ségments (à cathode commune)
Exemple
Câblage
Exemple de programme
Le programme ci-dessous affiche alternativement 0 et 1 au rythme de la seconde.
void setup()
{
//
pinMode(2, OUTPUT); //led e
pinMode(3, OUTPUT); //led d
pinMode(4, OUTPUT); //led c
pinMode(5, OUTPUT); //led b
pinMode(6, OUTPUT); //led a
pinMode(7, OUTPUT); //led f
pinMode(8, OUTPUT); //led g
}
void loop()
{
digitalWrite(2, HIGH); //led e
digitalWrite(3, HIGH); //led d
digitalWrite(4, HIGH); //led c
digitalWrite(5, HIGH); //led b
digitalWrite(6, HIGH); //led a
digitalWrite(7, HIGH); //led f
digitalWrite(8, LOW); //led g
delay(1000);
digitalWrite(2, LOW); //led e
digitalWrite(3, LOW); //led d
digitalWrite(4, HIGH); //led c
digitalWrite(5, HIGH); //led b
digitalWrite(6, LOW); //led a
digitalWrite(7, LOW); //led f
digitalWrite(8, LOW); //led g
delay(1000);
}