Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

const int pins[7] ={2, 3, 4, 5, 6, 7, 8 };

const byte numbersDisplayAnode[10] ={0b0111111, //0

0b0000101, //1

0b1011011, //2

0b1010111, //3

0b1100101, //4

0b1110110, //5

0b1111110, //6

0b0000111, //7

0b1111111, //8

0b1100111; //9

void setup() {

for(int i = 0; i<7; i++){

pinMode(pins[i], OUTPUT);

lightSegments(0);

void loop() {

for(int i = 0; i < 10; i++) {

lighSegments(i);
delay(500);

void lightSegments(int number){

byte numberBit = numberDisplayAnode[number]

for (int i = 0; i < 7; i++) {

int bit = bitRead (numberBit, bit);

idigital write (pins[i], bit);

You might also like