Here is a little board that I have made. Included the eagle files, so you can do whatever you want with it. It's copyright free.
here is a code to flash a led for 3 second and power the mcu down, and with a push of a button, it powers on again, and flashes a led for 3 second again.
/*
D0-d4
D2 mosfet output and LED
D0-D1, button input; D1-external interrupt
74-595 shifter
D2-LCK
D3-SCK
D4-sIn
*/
#include <avr/sleep.h>
#include <avr/interrupt.h>
int toggle=0;
int count=0;
ISR(INT0_vect) {
sleep_disable();
count=0;
}
void setup() {
pinMode(2, OUTPUT);
pinMode (1, INPUT); //interrupt
digitalWrite(1, HIGH);
}
void loop() {
digitalWrite(2, toggle);
delay(100);
count++;
toggle=!toggle;
if(count>=30){
digitalWrite(2, LOW);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
GIMSK = 1<<INT0;
sei();
sleep_mode();
}
}
tiny.zip (32.1 KB)