aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/appl/arduino/blocks/led-mega.frt
blob: ada5b3617a11d94898b3a332c6c68b7d0a199444 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
\ let the led at digital-13 aka PortB.7 blink

\ 
$25 constant PORTB
$24 constant DDRB

\ initialize the Port: change to output mode
: led-init
  $80 DDRB c!
;

\ turn the led on
: led-on
  $80 PORTB c!
;

\ turn the led off
: led-off
  0 PORTB c!
;

\ let led blink once
: led-blink
  led-on 500 ms led-off 500 ms
;

\ let led blink until a keystroke
: blink
    ." press any key to stop "
    begin
       led-blink
       key?
    until
    key drop \ we do not want to keep this key stroke
;

\ and do it....
led-init blink