Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define NUM_LEDS 32
- #define DATA_PIN 12
- #define CLOCK_PIN 11
- CRGB leds[NUM_LEDS];
- uint8_t ledctr = 0; //
- void setup() {
- delay(1000);
- Serial.begin(57600);
- FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN>(leds, NUM_LEDS);
- }
- void loop() {
- // FadeUp();
- newFade();
- FastLED.show();
- delay(33);
- } // loop()
- void FadeUp(){
- for (int i=0; i<255; i=i+5) {
- leds[ledctr].g = i;
- delay(10);
- FastLED.show();
- }
- if (ledctr++ > NUM_LEDS-1) {
- ledctr = 0;
- FastLED.clear();
- }
- }
- void newFade() {
- for (int i=0; i<9; i++) {
- leds[ledctr].g = pow(2,i)-1;
- delay(100);
- FastLED.show();
- }
- if (ledctr++ > NUM_LEDS-1) {
- ledctr = 0;
- FastLED.clear();
- }
- }
Add Comment
Please, Sign In to add comment