#include <Arduino.h>
#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 16
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 7
//#define CLOCK_PIN 13
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup()
{
//Serial.begin(57600);
//Serial.println("resetting");
FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(255);
}
void fadeall()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i].nscale8(250);
}
}
void loop()
{
//leds[0] = CRGB::Red;
// FastLED.show();
//static uint8_t hue = 180;
//Serial.print(hue);
// First slide the led in one direction
for (int i = (NUM_LEDS) ; i > 0; i--)//(int i = 0; i < NUM_LEDS; i++)
{
// Set the i'th led to red
leds[i] = CRGB(34, 251, 5);//CHSV((hue+50), 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
//leds[i] = CRGB::Black;
//fadeall();
// Wait a little bit before we loop around and do it again
delay(5);
}
//Serial.print("x");
// Now go in the other direction.
for (int i = 0; i <= NUM_LEDS; i++)//(int i = (NUM_LEDS) ; i >= 0; i--)
{
// Set the i'th led to red
leds[i] = CRGB(248, 15, 15);//CHSV((hue-60), 255, 255);
//Serial.println(hue);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
//leds[i] = CRGB::Black;
//fadeall();
// Wait a little bit before we loop around and do it again
delay(800);
}
delay(2000);
}