summaryrefslogtreecommitdiff
path: root/Example01/main.c
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-02-26 00:46:09 -0600
committerNathan Ringo <nathan@remexre.com>2024-02-26 00:46:09 -0600
commitfec505240f22065aaea2ee80c1082cad136559bb (patch)
treec5154ef52e8792b9470957332caeedb925604012 /Example01/main.c
Initial commitHEADtrunk
Diffstat (limited to 'Example01/main.c')
-rw-r--r--Example01/main.c14
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);
+ }
+}