66#include " esp32-hal.h"
77
88#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
1010
1111//
1212// Note: This example uses Neopixel LED board, 32 LEDs chained one
1616// Bits encoded as pulses as follows:
1717//
1818// "0":
19- // ---+ +--------------+
20- // | | |
19+ // +-------+ +--
2120// | | |
2221// | | |
2322// | | |
24- // +-------+ +--
23+ // ---| |--------------|
24+ // + + +
2525// | 0.4us | 0.85 0us |
2626//
2727// "1":
28- // ---+ +-------+
28+ // + ------------- + +--
2929// | | |
3030// | | |
3131// | | |
3232// | | |
33- // + ------------- + +--
33+ // ---+ +-------+
3434// | 0.8us | 0.4us |
3535
36- rmt_data_t led_data[NR_OF_PIXELS ];
36+ rmt_data_t led_data[NR_OF_ALL_BITS ];
3737
3838rmt_obj_t * rmt_send = NULL ;
3939
@@ -63,9 +63,15 @@ void loop()
6363 for (col=0 ; col<3 ; col++ ) {
6464 for (bit=0 ; bit<8 ; bit++){
6565 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 = 1 ;
6770 } 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 ;
6975 }
7076 i++;
7177 }
@@ -77,7 +83,7 @@ void loop()
7783 }
7884
7985 // Send the data
80- rmtWrite (rmt_send, led_data, NR_OF_PIXELS );
86+ rmtWrite (rmt_send, led_data, NR_OF_ALL_BITS );
8187
8288 delay (100 );
8389}
0 commit comments