Hello all,
I am currently working on an Arduino IoT Cloud project where I want to connect two LED lamps.
I have broken down my code to an absolute minimum, because the actually simplest part just doesn't want to work....
// FastLED - Version: Latest
#include <FastLED.h>
#define NUM_LEDS 24
#define DATA_PIN 12
CRGB leds[NUM_LEDS];
#include "thingProperties.h"
void setup() {
Serial.begin(9600);
delay(1500);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(4);
ArduinoCloud.printDebugInfo();
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
FastLED.clear();
FastLED.show();
}
void loop() {
ArduinoCloud.update();
while(true) {
for(uint8_t hue = 0; hue < 255; hue++) {
Serial.println(hue);
fill_solid(leds, NUM_LEDS, CHSV(hue, 255, 255));
FastLED.show();
delay(50);
}
}
}
What I currently want to achieve: the LED ring should simply iterate through all Hue values, creating a rainbow effect.
Unfortunately, my Nano 33 IoT does not behave as desired. After about 1 1/4 iterations, the Arduino simply restarts.
The debugging output shows me values from 0-254 and then from 0-~58, then it restarts.
This is driving me crazy. What am I missing here?
By the way, I know that theoretically I wouldn't need the While loop in this case. However, as I said, this is only a part from the actual code, in which I only run the rainbow effect as long as a button is pressed.
// Edit
I just tested it without the While loop. This is how it works. Can someone explain me why? And how I can make it run in a loop as well?