Created
June 10, 2017 17:43
-
-
Save amatus/1645dc64b21936f4b01bf5aa364577b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
#include <avr/sleep.h> | |
void main() | |
{ | |
static char state __attribute__ ((section (".noinit"))); | |
DDRB |= (1 << PB2); | |
if (state) | |
{ | |
PORTB |= (1 << PB2); | |
} | |
else | |
{ | |
PORTB &= ~(1 << PB2); | |
} | |
state = !state; | |
set_sleep_mode(SLEEP_MODE_PWR_DOWN); | |
sleep_enable(); | |
sleep_cpu(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment