-
Notifications
You must be signed in to change notification settings - Fork 4
/
LEDPWMstrip3.txt
44 lines (29 loc) · 963 Bytes
/
LEDPWMstrip3.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
FORTH DECIMAL
12 CONSTANT PWMR1 2 CONSTANT CHAN1
13 CONSTANT PWMR2 3 CONSTANT CHAN2
14 CONSTANT PWMR3 4 CONSTANT CHAN3
FORTH DEFINITIONS ALSO LEDC
: INIT-PWM ( --)
PWMR1 CHAN1 LEDCATTACHPIN
CHAN1 4000 50 LEDCSETUP drop
PWMR2 CHAN2 LEDCATTACHPIN
CHAN2 4000 50 LEDCSETUP drop
PWMR3 CHAN3 LEDCATTACHPIN
CHAN3 4000 50 LEDCSETUP drop
;
DEFER LEDPWM
: LEDPWM1 100 * CHAN1 SWAP LEDCWRITE ;
: LEDPWM2 100 * CHAN2 SWAP LEDCWRITE ;
: LEDPWM3 100 * CHAN3 SWAP LEDCWRITE ;
: RED ['] LEDPWM1 IS LEDPWM ;
: BLUE ['] LEDPWM2 IS LEDPWM ;
: GREEN ['] LEDPWM3 IS LEDPWM ;
INIT-PWM
RED
50 VALUE DELAY
: WAIT DELAY MS ;
: STEST 2000 0 DO I LEDPWM WAIT 100 +LOOP ;
: STEST2 2000 0 DO 2000 I - LEDPWM WAIT 100 +LOOP ;
: LEDTEST STEST2 STEST STEST2 0 LEDPWM ;
: LEDTEST2 0 ?DO RED LEDTEST BLUE LEDTEST GREEN LEDTEST LOOP 0 LEDPWM ;
LEDTEST