We have published an official library that supports Arduino-compatible Wi-Fi-enabled boards, along with several examples. The library supports the Arduino MKR1000, Arduino MKR WiFi 1010, Arduino Uno WiFi Rev2, Arduino Mega WiFi Rev2, Arduino Uno R4 WiFi, ESP8266, and ESP32. Include the library at the top of your Arduino sketch, use the method CheerLights.getCurrentColor(), and set the color of your RGB LEDs.
Arduino Library Installation
- Open the Arduino IDE.
- Select Tools > Manage Libraries.
- Search for “CheerLights” and click “install”.
CheerLights Arduino Methods
begin(const char* ssid, const char* password)
: Initialize the library with your WiFi credentials to let the library handle the WiFi connection.begin()
: Initialize the library without WiFi credentials (use this to manually connect to the WiFi network and manage the WiFi connection outside the library).reconnect()
: Reconnect to the WiFi network.isConnected()
: Returns a boolean indicating whether the library is connected to the WiFi network.getCurrentColor()
: Get the current CheerLights color from ThingSpeak channel 1417. Returns a pointer to a constant char array.currentColorName()
: The current CheerLights color name (e.g., “red”). Returns a pointer to a constant char array.currentColorHex()
: The current CheerLights color as a hex value (e.g., 0xFF0000). Returns a uint32_t.currentRed()
,currentGreen()
,currentBlue()
: The RGB values for the current CheerLights color (e.g., 255, 0, 0). Returns a uint8_t.hasColorChanged()
: Returns a boolean indicating whether the current CheerLights color has changed since the last call to this method.
CheerLights Arduino Library Reference: https://reference.arduino.cc/reference/en/libraries/cheerlights/