Hello, I have an Arduino Nano RP2040 Connect board.
I was trying for the first time to implement some things in it to test out and learn about Arduino.
I have a problem with a function listed below. If I understand correctly, for me to be able to change the colour of the LED on my board I have to get the colour value first and then write the desired colour value to the pins but, I have a problem getting the colour.
I would appreciate it if someone could help me with the code. Thank you in advance.
// Function to handle color changes
void onColorChange() {
if (led) { // Only update color if the LED is ON
uint8_t red, green, blue;
// Extract RGB components from the CloudColor object
color.getValue(red green blue); // Get the red, green, and blue values
// Set the RGB LED to the specified color
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
// Debug output
Serial.print("Color changed: R=");
Serial.print(red);
Serial.print(" G=");
Serial.print(green);
Serial.print(" B=");
Serial.println(blue);
} else {
Serial.println("LED is OFF. Cannot change color.");
}

