chance variable matters now

This commit is contained in:
Neale Pickett 2018-08-05 20:42:25 +00:00
parent fde662bbee
commit c41f6ddcc0
2 changed files with 13 additions and 2 deletions

View File

@ -68,8 +68,13 @@ void loop() {
} }
int triggerWeather(String command) { int triggerWeather(String command) {
bool strike = false;
if (command==String("f")) { if (command==String("f")) {
strike = true;
} else if (random(100) < chance) {
strike = true;
}
if (strike) {
int led = random(PIXEL_COUNT); int led = random(PIXEL_COUNT);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
// Use this line to keep the lightning focused in one LED. // Use this line to keep the lightning focused in one LED.

View File

@ -89,8 +89,14 @@ void setup() {
} }
void loop() { void loop() {
bool strike = false;
String trigger = readFromBluetooth(); String trigger = readFromBluetooth();
if (trigger==String("f")) { if (trigger==String("f")) {
strike = true;
} else if (random(100) < chance) {
strike = true;
}
if (strike) {
int led = random(NUM_LEDS); int led = random(NUM_LEDS);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
// Use this line to keep the lightning focused in one LED. // Use this line to keep the lightning focused in one LED.