/* POV Pendant v2 - see http://www.technoblogy.com/show?201J David Johnson-Davies - www.technoblogy.com - 7th March 2021 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 const int Green = 0; const int Red = 1; const int Blue = 2; const int Colours = 6; volatile int Output = 0; unsigned int Seed = 1; unsigned int Random (void) { int Temp = Seed & 1; Seed = Seed >> 1; if (Temp == 1) Seed = Seed ^ 0xB400; return Seed; } void delay (unsigned long millis) { for (volatile unsigned long i = 23*millis; i!=0; i--); } // Turn next light on ISR(TIM0_OVF_vect) { Output = (Output+1) % Colours; PORTB = Output+1; } // Turn all lights off ISR(TIM0_COMPA_vect) { PORTB = 0xFF; } void setup () { sei(); DDRB = 0x07; TCCR0A = 2<=0; b--) { OCR0A = b; delay(2); } PORTB = 0xFF; // Turn off LEDs sleep_enable(); sleep_cpu(); }