Skip to content

Commit 1c7e329

Browse files
david-cermakme-no-dev
authored andcommitted
RMT: Fix in bitshift of NeoPixel example project (#2986)
Fixed bit shift in demo application of using RMT peripheral. Init data array to be transmitted was off by one, as for the first iteration (i==0) the mask was 1<<8, which results in shifted RGB value in color variable Closes #2921
1 parent c17b212 commit 1c7e329

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/ESP32/examples/RMT/RMTWriteNeoPixel/RMTWriteNeoPixel.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void loop()
6262
for (led=0; led<NR_OF_LEDS; led++) {
6363
for (col=0; col<3; col++ ) {
6464
for (bit=0; bit<8; bit++){
65-
if ( (color[col] & (1<<(8-bit))) && (led == led_index) ) {
65+
if ( (color[col] & (1<<(7-bit))) && (led == led_index) ) {
6666
led_data[i].level0 = 1;
6767
led_data[i].duration0 = 8;
6868
led_data[i].level1 = 0;

0 commit comments

Comments
 (0)