/* Twinkling Pendant - see http://www.technoblogy.com/show?3RMX David Johnson-Davies - www.technoblogy.com - 23rd February 2022 ATtiny10 @ 1MHz (internal oscillator) CC BY 4.0 Licensed under a Creative Commons Attribution 4.0 International license: http://creativecommons.org/licenses/by/4.0/ */ #include #include uint8_t Power __attribute__ ((section (".noinit"))); // LEDs: 426 153 const uint8_t Mask = 0b011101110; // Valid light positions volatile uint8_t Lights = 0; // All off volatile uint8_t Ticks; // Delay in 1/200ths of a second void delay (uint8_t msec5) { Ticks = 0; while (Ticks < msec5); } // Multiplex LEDs ISR(TIM0_COMPA_vect) { static uint8_t Count; PORTB = 0; // All bits low DDRB = 0; // All pins inputs Count = (Count + 1) % 3; uint8_t bits = Lights>>(3*Count) & 0b111; DDRB = 1<