aboutsummaryrefslogtreecommitdiff
path: root/forth/flash-led.fs
diff options
context:
space:
mode:
Diffstat (limited to 'forth/flash-led.fs')
-rw-r--r--forth/flash-led.fs23
1 files changed, 23 insertions, 0 deletions
diff --git a/forth/flash-led.fs b/forth/flash-led.fs
new file mode 100644
index 0000000..08fc643
--- /dev/null
+++ b/forth/flash-led.fs
@@ -0,0 +1,23 @@
+-flash-led-avr
+marker -flash-led-avr
+\ PB5 is Arduino digital pin 13.
+
+$0023 constant pinb
+$0024 constant ddrb
+$0025 constant portb
+
+$0026 constant pinc
+$0027 constant ddrc
+$0028 constant portc
+
+$0029 constant pind
+$002a constant ddrd
+$002b constant portd
+
+1 #5 lshift constant bit5
+
+: init bit5 ddrb mset ; \ set pin as output
+: do_output portb c@ bit5 xor portb c! ; \ toggle the bit
+: main init begin do_output #500 ms again ;
+
+main