diff --git a/examples/1dig_7seg_display.c b/examples/1dig_7seg_display.c index 1b4c483..ba8f7e1 100644 --- a/examples/1dig_7seg_display.c +++ b/examples/1dig_7seg_display.c @@ -25,24 +25,22 @@ int main(void) { _delay_ms(1000); } + uint8_t infinity[] = { + 0b00000001, + 0b00000011, + 0b10000010, + 0b10100000, + 0b00110000, + 0b00010100, + 0b10000100, + 0b11000000, + } // show infinity while (1) { - setByte(dataPin, clockPin, latchPin, 0b00000001); - _delay_ms(50); - setByte(dataPin, clockPin, latchPin, 0b00000011); - _delay_ms(50); - setByte(dataPin, clockPin, latchPin, 0b10000010); - _delay_ms(50); - setByte(dataPin, clockPin, latchPin, 0b10100000); - _delay_ms(50); - setByte(dataPin, clockPin, latchPin, 0b00110000); - _delay_ms(50); - setByte(dataPin, clockPin, latchPin, 0b00010100); - _delay_ms(50); - setByte(dataPin, clockPin, latchPin, 0b10000100); - _delay_ms(50); - setByte(dataPin, clockPin, latchPin, 0b11000000); - _delay_ms(50); + for (uint8_t j = 0; j <= len(infinity); j++) { + setByte(dataPin, clockPin, latchPin, infinity[j]); + _delay_ms(50); + } } } return 1; diff --git a/lib/dig_7seg_display.c b/lib/dig_7seg_display.c index 1f1bc11..45b26de 100644 --- a/lib/dig_7seg_display.c +++ b/lib/dig_7seg_display.c @@ -2,14 +2,12 @@ void setNumber(uint8_t dataPin, uint8_t clockPin, uint8_t latchPin, uint8_t figure) { turn(latchPin, OFF); - //shiftOut(dataPin, clockPin, digitToByte + figure); shiftOut(dataPin, clockPin, digitToByte[figure]); turn(latchPin, ON); } void setByte(uint8_t dataPin, uint8_t clockPin, uint8_t latchPin, uint8_t byte) { turn(latchPin, OFF); - //shiftOut(dataPin, clockPin, digitToByte + figure); shiftOut(dataPin, clockPin, byte); turn(latchPin, ON); }