6
6
#include " esp32-hal.h"
7
7
8
8
#define NR_OF_LEDS 8 *4
9
- #define NR_OF_PIXELS 24 *NR_OF_LEDS
9
+ #define NR_OF_ALL_BITS 24 *NR_OF_LEDS
10
10
11
11
//
12
12
// Note: This example uses Neopixel LED board, 32 LEDs chained one
16
16
// Bits encoded as pulses as follows:
17
17
//
18
18
// "0":
19
- // ---+ +--------------+
20
- // | | |
19
+ // +-------+ +--
21
20
// | | |
22
21
// | | |
23
22
// | | |
24
- // +-------+ +--
23
+ // ---| |--------------|
24
+ // + + +
25
25
// | 0.4us | 0.85 0us |
26
26
//
27
27
// "1":
28
- // ---+ +-------+
28
+ // + ------------- + +--
29
29
// | | |
30
30
// | | |
31
31
// | | |
32
32
// | | |
33
- // + ------------- + +--
33
+ // ---+ +-------+
34
34
// | 0.8us | 0.4us |
35
35
36
- rmt_data_t led_data[NR_OF_PIXELS ];
36
+ rmt_data_t led_data[NR_OF_ALL_BITS ];
37
37
38
38
rmt_obj_t * rmt_send = NULL ;
39
39
@@ -63,9 +63,15 @@ void loop()
63
63
for (col=0 ; col<3 ; col++ ) {
64
64
for (bit=0 ; bit<8 ; bit++){
65
65
if ( (color[col] & (1 <<(8 -bit))) && (led == led_index) ) {
66
- led_data[i].val = 0x80070006 ;
66
+ led_data[i].level0 = 1 ;
67
+ led_data[i].duration0 = 8 ;
68
+ led_data[i].level1 = 0 ;
69
+ led_data[i].duration1 = 4 ;
67
70
} else {
68
- led_data[i].val = 0x80040008 ;
71
+ led_data[i].level0 = 1 ;
72
+ led_data[i].duration0 = 4 ;
73
+ led_data[i].level1 = 0 ;
74
+ led_data[i].duration1 = 8 ;
69
75
}
70
76
i++;
71
77
}
@@ -77,7 +83,7 @@ void loop()
77
83
}
78
84
79
85
// Send the data
80
- rmtWrite (rmt_send, led_data, NR_OF_PIXELS );
86
+ rmtWrite (rmt_send, led_data, NR_OF_ALL_BITS );
81
87
82
88
delay (100 );
83
89
}
0 commit comments