parent
ccb0410c05
commit
f4fbb400d1
|
@ -0,0 +1,40 @@
|
||||||
|
#include <FastLED.h>
|
||||||
|
|
||||||
|
// How many leds in your strip?
|
||||||
|
#define NUM_LEDS 300
|
||||||
|
|
||||||
|
//defining locations of pins
|
||||||
|
#define DATA_PIN 2
|
||||||
|
#define BUTTON_PIN 4
|
||||||
|
|
||||||
|
// Define the array of leds
|
||||||
|
CRGB leds[NUM_LEDS];
|
||||||
|
|
||||||
|
//assigning locations of pins
|
||||||
|
int buttonPin = 8;
|
||||||
|
int ledPin = 13;
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
|
||||||
|
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
|
||||||
|
Serial.begin(115200);
|
||||||
|
pinMode(BUTTON_PIN, INPUT_PULLUP); //use internal pullup resistor
|
||||||
|
|
||||||
|
} //void setup
|
||||||
|
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// Move a single LED down the strip
|
||||||
|
for (int i = 0; i < NUM_LEDS; i++) {
|
||||||
|
leds[i] = CRGB::Red; // Set the current LED to red
|
||||||
|
FastLED.show(); // Display the updated LED colors
|
||||||
|
//delay(0.001); // Wait for 100 milliseconds
|
||||||
|
delayMicroseconds(100);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
leds[i] = CRGB::Black; // Turn off the current LED
|
||||||
|
FastLED.show(); // Update the strip
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue