Scrolls through all colours of spectrum
20 WS2811 LEDs
1 Arduino Uno
Connect green wire of LEDs to pin 5
Connect red wire of LEDs to +5V
Connect white wire of LEDs to GND
Connect USB cable to Arduino
Call up Arduino IDE software
Select correct board (Tools/Board)
Select correct Port (COM 4 in my case)
Verify and upload code (below)
===================================
#include <FastLED.h>
#define LED_PIN 5
#define NUM_LEDS 20
CRGB leds[NUM_LEDS];
uint8_t hue = 0;
void setup() {
FastLED.addLeds<WS2811, LED_PIN, RGB>(leds, NUM_LEDS);
FastLED.setBrightness(255); // Set brightness to 100%
}
void loop() {
fill_solid(leds, NUM_LEDS, CHSV(hue, 255, 255));
FastLED.show();
hue++; // Move to the next colour
delay(500); // Change every 0.5 seconds
}
No comments:
Post a Comment