ATTINY25/45/85 Low Power Led Flasher
Connect Led to PIN PB0 0f Tiny25/45/85 (Pin No.5) Code: //ATTINY25/45/85 #include <avr/sleep.h> #include <avr/wdt.h> #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) #endif #ifndef sbi #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) #endif int pinLed = 0; volatile boolean f_wdt = 1; void setup() { pinMode(pinLed, OUTPUT); // 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms // 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec setup_watchdog(9); // approximately 8 seconds sleep } void loop() { if (f_wdt == 1) { // wait for timed out watchdog / flag is set when a watchdog timeout occurs f_wdt = 0; // reset flag digitalWrite(pinLed, HIGH); // let led blink delay(70); //On Time digitalWrite(pinLed, LOW); pinMode(pinLed, INPUT); // set all used p...