This is a demo for driving a Neopixel LED Strip with M5Stack Atom Lite for X-mas tree decoration.
Install FastLED library using Arduino IDE > Tools > Manage Libraries...
Connect Neopixel LED strip to Atom Lite
[Neopixel Strip] [Atom Lite]
GND. ----------------GND
5V --------------------5V
Data------------------G25
Create a new sketch in the Arduino IDE and copy and paste the code below and compile/upload to the Atom Lite.
#include <FastLED.h>
const byte PIN_LEDSTRIP = 25;
const byte NUM_LEDS = 7;
CRGB ledStrip[NUM_LEDS];
uint8_t rainbow[] = {CRGB::Violet, CRGB::Indigo, CRGB::Blue, CRGB::Green, CRGB::Yellow, CRGB::Orange, CRGB::Red};
void setup()
{
delay(1000);
FastLED.addLeds<NEOPIXEL, PIN_LEDSTRIP>(ledStrip, NUM_LEDS);
FastLED.clear();
FastLED.setBrightness(10);;
FastLED.show();
}
void loop() {
ledStrip[0] = CRGB::Violet; FastLED.show(); delay(900);
ledStrip[0] = CRGB::Black; FastLED.show(); delay(50);
ledStrip[1] = CRGB::Indigo; FastLED.show(); delay(900);
ledStrip[1] = CRGB::Black; FastLED.show(); delay(50);
ledStrip[2] = CRGB::Blue; FastLED.show(); delay(900);
ledStrip[2] = CRGB::Black; FastLED.show(); delay(50);
ledStrip[3] = CRGB::Green; FastLED.show(); delay(900);
ledStrip[3] = CRGB::Black; FastLED.show(); delay(50);
ledStrip[4] = CRGB::Yellow; FastLED.show(); delay(900);
ledStrip[4] = CRGB::Black; FastLED.show(); delay(50);
ledStrip[5] = CRGB::Orange; FastLED.show(); delay(900);
ledStrip[5] = CRGB::Black; FastLED.show(); delay(50);
ledStrip[6] = CRGB::Red; FastLED.show(); delay(900);
ledStrip[6] = CRGB::Black; FastLED.show(); delay(50);
}
Naveen
53 projects • 193 followers
Bioinformatician, Researcher, Programmer, Maker, Robotics Enthusiast, Community contributor Machine Learning Tokyo
Comments