Skip to content

Commit

Permalink
Fixed infinite loop in strandtest_nodelay and pick a more suitable de…
Browse files Browse the repository at this point in the history
…fault LED_PIN for ESP32.
  • Loading branch information
rimim committed Sep 21, 2022
1 parent 56e662c commit 53e86b4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions examples/strandtest_nodelay/strandtest_nodelay.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1:
#ifdef ESP32
// Cannot use 6 as output for ESP. Pins 6-11 are connected to SPI flash. Use 16 instead.
#define LED_PIN 16
#else
#define LED_PIN 6
#endif

// How many NeoPixels are attached to the Arduino?
#define LED_COUNT 60
Expand Down Expand Up @@ -125,7 +130,7 @@ void theaterChase(uint32_t color, int wait) {
strip.setPixelColor(i + pixelQueue, color); // Set pixel's color (in RAM)
}
strip.show(); // Update strip to match
for(int i=0; i < pixelNumber; i+3) {
for(int i=0; i < pixelNumber; i+=3) {
strip.setPixelColor(i + pixelQueue, strip.Color(0, 0, 0)); // Set pixel's color (in RAM)
}
pixelQueue++; // Advance current pixel
Expand All @@ -150,11 +155,11 @@ void rainbow(uint8_t wait) {
void theaterChaseRainbow(uint8_t wait) {
if(pixelInterval != wait)
pixelInterval = wait; // Update delay time
for(int i=0; i < pixelNumber; i+3) {
for(int i=0; i < pixelNumber; i+=3) {
strip.setPixelColor(i + pixelQueue, Wheel((i + pixelCycle) % 255)); // Update delay time
}
strip.show();
for(int i=0; i < pixelNumber; i+3) {
for(int i=0; i < pixelNumber; i+=3) {
strip.setPixelColor(i + pixelQueue, strip.Color(0, 0, 0)); // Update delay time
}
pixelQueue++; // Advance current queue
Expand Down

1 comment on commit 53e86b4

@sfranzyshen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

Please sign in to comment.