
Arduino Quick Start
APIs and an example sketch for the RGB LED on Atom-Lite / Atom-Matrix.
#include <M5Unified.h>
#include <Adafruit_NeoPixel.h>
#define LED_PIN 27
#define NUM_LEDS 25
Adafruit_NeoPixel strip(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
M5.begin();
Serial.begin(115200);
Serial.printf("RGB LED Test\n");
strip.begin();
}
void loop() {
// Red
for (char i = 0; i <= NUM_LEDS; i++) { strip.setPixelColor(i, strip.Color(255, 0, 0)); }
strip.show();
delay(500);
// Green
for (char i = 0; i <= NUM_LEDS; i++) { strip.setPixelColor(i, strip.Color(0, 255, 0)); }
strip.show();
delay(500);
// Blue
for (char i = 0; i <= NUM_LEDS; i++) { strip.setPixelColor(i, strip.Color(0, 0, 255)); }
strip.show();
delay(500);
// Yellow
for (char i = 0; i <= NUM_LEDS; i++) { strip.setPixelColor(i, strip.Color(255, 255, 0)); }
strip.show();
delay(500);
// Magenta
for (char i = 0; i <= NUM_LEDS; i++) { strip.setPixelColor(i, strip.Color(255, 0, 255)); }
strip.show();
delay(500);
// Cyan
for (char i = 0; i <= NUM_LEDS; i++) { strip.setPixelColor(i, strip.Color(0, 255, 255)); }
strip.show();
delay(500);
// White (all on)
for (char i = 0; i <= NUM_LEDS; i++) { strip.setPixelColor(i, strip.Color(255, 255, 255)); }
strip.show();
delay(500);
// Black (all off)
for (char i = 0; i <= NUM_LEDS; i++) { strip.setPixelColor(i, strip.Color(0, 0, 0)); }
strip.show();
delay(500);
}Running result:
The Atom-Lite/Atom-Matrix RGB LED uses the Adafruit NeoPixel library. For more information: