Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
byte digits[] = {0b1111110 , 0b0110000, 0b1101101, 0b1111001, 0b0110011, 0b1011011, 0b1011111, 0b1110000, 0b1111111, 0b1111011};
// pins to segments g,f,e,d,c,b,a
byte pins[] = {3,4,5,6,7,8,9};
void displayNumber(int aNumber) {
for (int i = 0; i < 7; i++) {
digitalWrite(pins[i], digits[aNumber] & (1 << i));
}
}
void setup(){
for (int i = 0; i < 7; i++){
pinMode(pins[i], OUTPUT);
}
}
void loop(){
for (int i = 0; i < 10; i++) {
displayNumber(i);
delay(1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment