36 lines
982 B
C++
36 lines
982 B
C++
/// @file Blink.ino
|
|
/// @brief Blink the first LED of an LED strip
|
|
/// @example Blink.ino
|
|
|
|
#include <FastLED.h>
|
|
|
|
// How many leds in your strip?
|
|
#define NUM_LEDS 3
|
|
|
|
// For led chips like WS2812, 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
|
|
// Clock pin only needed for SPI based chipsets when not using hardware SPI
|
|
#define DATA_PIN 3
|
|
//#define CLOCK_PIN 13
|
|
|
|
// Define the array of leds
|
|
CRGB leds[NUM_LEDS];
|
|
|
|
#define POTI_PIN 2
|
|
int POTI_VALUE = 0;
|
|
|
|
void setup() {
|
|
FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS); // GRB ordering is typical
|
|
}
|
|
|
|
void loop() {
|
|
leds[0] = CRGB::Red;
|
|
leds[1] = CRGB::Blue;
|
|
leds[2] = CRGB::Green;
|
|
FastLED.setBrightness(map(analogRead(POTI_PIN), 0, 8191, 8, 255));
|
|
FastLED.show();
|
|
delay(1);
|
|
//POTI_VALUE = map(analogRead(POTI_PIN), 0, 8191, 0, 255);
|
|
}
|