-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathESP32forth-knight-rider.txt
90 lines (80 loc) · 2.27 KB
/
ESP32forth-knight-rider.txt
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
( KNIGHT RIDER "long version" for ESP32Forth )
DECIMAL
: ... 300 ms ;
...
15 constant GPIO15
...
4 constant GPIO4
...
2 CONSTANT GPIO2
...
5 constant GPIO5
...
18 constant GPIO18
...
19 constant GPIO19
...
23 constant GPIO23
...
12 constant GPIO12
...
13 constant GPIO13
...
14 constant GPIO14
...
4 constant GPIO4
...
5 constant GPIO5
...
: i-1 GPIO15 OUTPUT PINMODE low GPIO15 pin ;
...
: i1 i-1 GPIO4 OUTPUT PINMODE low GPIO4 pin low GPIO2 pin ;
...
: i2 GPIO5 OUTPUT PINMODE low GPIO5 pin GPIO18 OUTPUT PINMODE low GPIO18 pin ;
...
: i3 GPIO19 OUTPUT PINMODE low GPIO19 pin GPIO23 OUTPUT PINMODE low GPIO23 pin ;
...
: i4 GPIO12 OUTPUT PINMODE low GPIO12 pin GPIO13 OUTPUT PINMODE low GPIO13 pin
...
: i5 GPIO14 OUTPUT PINMODE low GPIO14 pin GPIO15 OUTPUT PINMODE low GPIO15 pin ;
...
: i6 GPIO4 OUTPUT PINMODE low GPIO4 pin GPIO5 OUTPUT PINMODE low GPIO5 pin ;
...
: init i1 i2 i3 i4 i5 i6 ;
...
low VALUE WOW
...
: all2 WOW GPIO15 pin WOW GPIO4 pin ;
...
: all3 WOW GPIO5 pin WOW GPIO18 pin ;
...
: all1 WOW GPIO19 pin WOW GPIO23 pin WOW GPIO12 pin WOW GPIO13 pin ;
...
: all ( n--) to wow WOW GPIO14 pin WOW GPIO2 pin all2 all3 all1 ;
...
CREATE ARRAY
...
GPIO15 , GPIO2 , GPIO4 , GPIO5 ,
...
GPIO18 , GPIO19 , GPIO23 , GPIO12 ,
...
GPIO14 , GPIO13 , GPIO14 ,
...
GPIO12 , GPIO23 , GPIO19 , GPIO18 ,
...
GPIO5 , GPIO4 , GPIO2 , GPIO15 ,
...
0 VALUE P# ( Pin number )
...
: PINN P# PIN :
...
50 VALUE DEL4 ( delay to blink 1 led )
...
: LED# ( n--) CELLS ARRAY + @ TO P# ;
...
: BLINK ( n--) LED# LOW PINN DEL4 MS HIGH PINN ;
...
: KNIGHT-RIDER HIGH ALL 20 0 DO I BLINK LOOP ;
...
: RUN ( --) init 10 0 DO KNIGHT-RIDER LOOP ;
...