diff --git a/cloud-lightning-photon/cloud-lightning-photon.ino b/cloud-lightning-photon/cloud-lightning-photon.ino index a8de13e..32b4292 100644 --- a/cloud-lightning-photon/cloud-lightning-photon.ino +++ b/cloud-lightning-photon/cloud-lightning-photon.ino @@ -68,8 +68,13 @@ void loop() { } int triggerWeather(String command) { - - if (command==String("f")) { + bool strike = false; + if (command==String("f")) { + strike = true; + } else if (random(100) < chance) { + strike = true; + } + if (strike) { int led = random(PIXEL_COUNT); for (int i = 0; i < 10; i++) { // Use this line to keep the lightning focused in one LED. diff --git a/cloud-lightning/cloud-lightning.ino b/cloud-lightning/cloud-lightning.ino index 44e5622..7aeabd6 100644 --- a/cloud-lightning/cloud-lightning.ino +++ b/cloud-lightning/cloud-lightning.ino @@ -89,8 +89,14 @@ void setup() { } void loop() { + bool strike = false; String trigger = readFromBluetooth(); if (trigger==String("f")) { + strike = true; + } else if (random(100) < chance) { + strike = true; + } + if (strike) { int led = random(NUM_LEDS); for (int i = 0; i < 10; i++) { // Use this line to keep the lightning focused in one LED.