Skip to content

Commit

Permalink
blink live&start LEDs while running screen saver
Browse files Browse the repository at this point in the history
  • Loading branch information
drayde committed Feb 24, 2018
1 parent 03284aa commit 0f0e58b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions TWANG.ino
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,10 @@ void loop() {
}
}
if(stage == Stage::SCREENSAVER){
digitalWrite(startLed, HIGH);
if (digitalRead(startButton) == LOW) {
startGame();
} else {
screenSaverTick();
screenSaverTick();
}
}else if(stage == Stage::PLAY){
// PLAYING
Expand Down Expand Up @@ -649,8 +648,20 @@ void updateLives(){
// ---------------------------------
// --------- SCREENSAVER -----------
// ---------------------------------

int screenSaverLedTick = 0;

void screenSaverTick(){
screenSaverMgr.Tick();
long mm = millis();
int screenSaverLedTickNew = mm/500;
if (screenSaverLedTickNew != screenSaverLedTick) {
screenSaverLedTick = screenSaverLedTickNew;
digitalWrite(lifeLEDs[0], random8(100)>50?HIGH:LOW);
digitalWrite(lifeLEDs[1], random8(100)>50?HIGH:LOW);
digitalWrite(lifeLEDs[2], random8(100)>50?HIGH:LOW);
digitalWrite(startLed, (screenSaverLedTick%2)?HIGH:LOW);
}
screenSaverMgr.Tick();
}

// ---------------------------------
Expand Down

0 comments on commit 0f0e58b

Please sign in to comment.