diff options
Diffstat (limited to 'Example01/main.c')
-rw-r--r-- | Example01/main.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Example01/main.c b/Example01/main.c new file mode 100644 index 0000000..76a47b2 --- /dev/null +++ b/Example01/main.c @@ -0,0 +1,14 @@ +#define F_CPU 3333333 +#include <avr/io.h> +#include <stdbool.h> + +int main(void) { + PORTF.DIR &= ~PIN3_bm; // button as input + PORTF.DIR |= PIN4_bm; // green as output + PORTF.DIR |= PIN5_bm; // red as output + + while (1) { + bool buttonp = PORTF.IN & PIN3_bm; + PORTF.OUT = 1 << (buttonp ? PIN4_bp : PIN5_bp); + } +} |