Thingiverse
Lamp with WS2812B led
by Thingiverse
Last crawled date: 5 years, 10 months ago
Lamp i design with three strips of WS2812B leds.
Total 39 leds and a Arduino Nano to control the light.
Adafruit effect aka FastLED
Please note I am not a programmer so I am in no way saying this is properly made. But this code works for me :)
Source code:
(https://gofile.io/?c=ZmQHGg)
#include
#define NUM_LEDS 39
#define BRIGHTNESS 170
CRGB leds[NUM_LEDS];
void setup() {
delay( 3000 ); // power-up safety delay
FastLED.addLeds(leds, 0, 13); //Pin 3, LED 0 to 13
FastLED.addLeds(leds, 13, 26); //Pin 5, LED 13 to 26
FastLED.addLeds(leds, 26, 39); //Pin 7, LED 26 to 39
FastLED.setBrightness( BRIGHTNESS );
}
void loop()
{
randomSeed(millis());
int wait=30;
rainbow(wait);
}
void rainbow(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256; j++) {
for(i=0; i CRGB ledColor = wheel((i*1+j) & 255);
leds[i]=ledColor;
}
FastLED.show();
FastLED.delay(wait);
}
}
CRGB wheel(byte WheelPos)
{
CRGB color;
if (WheelPos < 85) {
color.r = WheelPos * 3;
color.g = 255 - WheelPos * 3;
color.b = 0;
}
else if (WheelPos < 170) {
WheelPos -= 85;
color.r = 255 - WheelPos * 3;
color.g = 0;
color.b = WheelPos * 3;
}
else {
WheelPos -= 170;
color.r = 0;
color.g = WheelPos * 3;
color.b = 255 - WheelPos * 3;
}
return color;
}
Total 39 leds and a Arduino Nano to control the light.
Adafruit effect aka FastLED
Please note I am not a programmer so I am in no way saying this is properly made. But this code works for me :)
Source code:
(https://gofile.io/?c=ZmQHGg)
#include
#define NUM_LEDS 39
#define BRIGHTNESS 170
CRGB leds[NUM_LEDS];
void setup() {
delay( 3000 ); // power-up safety delay
FastLED.addLeds
FastLED.addLeds
FastLED.addLeds
FastLED.setBrightness( BRIGHTNESS );
}
void loop()
{
randomSeed(millis());
int wait=30;
rainbow(wait);
}
void rainbow(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256; j++) {
for(i=0; i
leds[i]=ledColor;
}
FastLED.show();
FastLED.delay(wait);
}
}
CRGB wheel(byte WheelPos)
{
CRGB color;
if (WheelPos < 85) {
color.r = WheelPos * 3;
color.g = 255 - WheelPos * 3;
color.b = 0;
}
else if (WheelPos < 170) {
WheelPos -= 85;
color.r = 255 - WheelPos * 3;
color.g = 0;
color.b = WheelPos * 3;
}
else {
WheelPos -= 170;
color.r = 0;
color.g = WheelPos * 3;
color.b = 255 - WheelPos * 3;
}
return color;
}
