Skip to content

Commit

Permalink
We should just turn the thing on/off
Browse files Browse the repository at this point in the history
Like the switch, could be used to zap and turn things on, rather than falshing
  • Loading branch information
arcbtc committed Aug 21, 2024
1 parent 8f4ebe3 commit 27f2bf0
Showing 1 changed file with 3 additions and 35 deletions.
38 changes: 3 additions & 35 deletions nostrZapLamp/nostrZapLamp.ino
Original file line number Diff line number Diff line change
Expand Up @@ -284,41 +284,9 @@ void changeBrightness() {
*/
void doLightningFlash(int numberOfFlashes) {

Serial.println("Flashing " + String(numberOfFlashes) + " times");

// turn lamp off
analogWrite(ledPin, lightBrightness / 3);

delay(100);

for(int flash = 1; flash <= numberOfFlashes; flash++) {
// turn the LED on
analogWrite(ledPin, 255);

// wait for the specified time, longer for the first flash and shorter for subsequent flashes
// int flashDuration = 250 / flash * random(1,5);
int flashDuration = 250;
delay(250);

// fast fade-out
for (int i = 255; i >= lightBrightness / 3; i = i - 2) {
analogWrite(ledPin, i); // set the LED brightness
delay(1); // wait for a moment
}
// analogWrite(ledPin, lightBrightness / 3);
delay(250);
}

// fade from lightBrightness / 3 to lightBrightness
for (int i = lightBrightness / 3; i <= lightBrightness; i = i + 1) {
analogWrite(ledPin, i); // set the LED brightness
delay(1); // wait for a moment
}

delay(250);

// set led to brightness
analogWrite(ledPin, lightBrightness);
analogWrite(ledPin, 255);
delay(5000);
analogWrite(ledPin, 0);
}

/**
Expand Down

0 comments on commit 27f2bf0

Please sign in to comment.