unsigned long previousMillis = 0; // store for Millis value
const long interval = 1000; // 1-second interval for process 1
int currentColor = 0; // Tracks the current colour: 0 = red, 1 = green, 2 = blue
void setup() {
Serial.begin(115200);
delay(100);
//setupEasyNeoPixels(48, 1);
xTaskCreate(arduinoTask, "arduino_task", 5000, NULL, 1, NULL);
}
void arduinoTask(void *pvParameter)
{
Serial.println("Hello World");
while (1) {
Serial.println("looping");
delay(1000);
}
}
void loop() {
unsigned long currentMillis = millis();
// Check if it's time to change the colour
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
// Change the colour based on currentColor index
if (currentColor == 0) {
//writeEasyNeoPixel(0, 10, 0, 0); // Red
currentColor = 1;
}
else if (currentColor == 1) {
//writeEasyNeoPixel(0, 0, 10, 0); // Green
currentColor = 2;
}
else if (currentColor == 2) {
//writeEasyNeoPixel(0, 0, 0, 10); // Blue
currentColor = 0;
}
}
}