Arduino Storm Paper Weight
Quickie desktop storm cloud reminiscent of a previous project for a friend - and this for the same friend - inspired by the death of Dan Garcia (FastLED creator). While aye typically despise LED projects - they are unavoidable - which is code for they look cool and positively augment a many projects. FastLED was an immense and approachable code for Neopixel and not being a strong coder my self - it is those who do, that often permit me the ability to build the things aye do.

Thx Dan.



Ingredients
Arduino Uno
1000uf Capacitor
220 ohm Resistor
Neopixel Strip
Pillow Stuffing .. stuff



Notation(s)
1. Credit to James Bruce for his Lightning Cloud FastLED code.
2. https://github.com/FastLED/FastLED
3. Storm in a Box -> how did aye make it blue?!
4. To not inundate the effect - aye added +30 leds to the count which then distributes the lightning over an imaginary strip.
5. Per #3 - not enough current from the 5V (for just 6?!) -- will hard wire to the female plug - may re-film gif -

// Lighting Cloud
// James Bruce

#include <FastLED.h>

#define NUM_LEDS 6
#define DATA_PIN 9

enum Mode {CLOUD, ACID, OFF, ON, RED, GREEN, BLUE, FADE};
Mode mode = CLOUD;
Mode lastMode = CLOUD;

int fade_h;
int fade_direction = 1;

CRGB leds[NUM_LEDS];

void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
Serial.begin(9600);
}

void loop() {
constant_lightning();
}

void single_colour(int H) {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV( H, 255, 255);
}
if (lastMode != mode) {
FastLED.show();
lastMode = mode;
}
delay(50);
}

void colour_fade() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV( fade_h, 255, 255);
}
if (fade_h > 254) {
fade_direction = -1;
}
else if (fade_h < 0) {
fade_direction = 1;
}
fade_h += fade_direction;
FastLED.show();
delay(100);
}

void reset() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV( 0, 0, 0);
}
FastLED.show();
}

void acid_cloud() {
for (int i = 0; i < NUM_LEDS; i++) {
if (random(0, 100) > 90) {
leds[i] = CHSV( random(0, 255), 255, 255);
}
else {
leds[i] = CHSV(0, 0, 0);
}
}
FastLED.show();
delay(random(5, 100));
reset();
//}
}

void rolling() {
for (int r = 0; r < random(2, 10); r++) {
for (int i = 0; i < NUM_LEDS; i++) {
if (random(0, 100) > 90) {
leds[i] = CHSV( 0, 0, 255);
}
else {
leds[i] = CHSV(0, 0, 0);
}
}
FastLED.show();
delay(random(5, 100));
reset();
}
}

void crack() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV( 0, 0, 255);
}
FastLED.show();
delay(random(10, 100));
reset();
}

void thunderburst() {
int rs1 = random(0, NUM_LEDS / 2);
int rl1 = random(10, 20);
int rs2 = random(rs1 + rl1, NUM_LEDS);
int rl2 = random(10, 20);
for (int r = 0; r < random(3, 6); r++) {
for (int i = 0; i < rl1; i++) {
leds[i + rs1] = CHSV( 0, 0, 255);
}
if (rs2 + rl2 < NUM_LEDS) {
for (int i = 0; i < rl2; i++) {
leds[i + rs2] = CHSV( 0, 0, 255);
}
}
FastLED.show();
delay(random(10, 50));
reset();
delay(random(10, 50));
}
}

void constant_lightning() {
switch (random(1, 4)) {
case 1:
thunderburst();
delay(random(10, 500));
break;
case 2:
rolling();
break;
case 3:
crack();
delay(random(50, 250));
break;
case 4:
acid_cloud();
break;
}
}

Archive
https://hackaday.io/project/167559-arduino-storm-paper-weight

@pkvi
"...may not meet professional standards."
12,138 miters
5 miters today
202 tenons
Subscribe