Official Arduino Library for CheerLights

I 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

  1. Open the Arduino IDE.
  2. Select Tools > Manage Libraries.
  3. Search for “CheerLights” and click “install”.
How to Install The CheerLights Library for Arduino

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.
  • currentHue()currentSaturation()currentValue(): The HSV values for the current CheerLights color (e.g. 0, 255, 255). Returns a uint16_t for hue and uint8_t for saturation and value.
  • hasColorChanged(): Returns a boolean indicating whether the current CheerLights color has changed since the last call to this method.

CheerLights Projects

Now, that you know about the Arduino library for CheerLights, you might be thinking about what you can do with it. CheerLights is a global network of synchronized lights. The lights are all set to the same color. Anyone can change the color by changing it on the CheerLights Discord Server and other social networks like Mastodon and BlueSky.

Get inspired by taking a look at the build gallery at the CheerLights website.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.