Skip to content

Commit

Permalink
Updating to Modulino 0.4.0 lib
Browse files Browse the repository at this point in the history
  • Loading branch information
lukdog committed Jul 26, 2024
1 parent b00703c commit e106ef8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions FlappyLED.ino
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,12 @@ void distanceLoop() {

#if !defined(BUTTONS)

float d = distanceSensor.get();

if(!distanceSensor.available()){
delay(1);
continue;
}

float d = distanceSensor.get();
unsigned long m = millis();

if(!isnan(d) && d < MAX_TOF_H && d > MIN_TOF_H){
Expand Down Expand Up @@ -329,13 +328,13 @@ void distanceLoop() {
delay(1);
}

float distance = distanceSensor.get();

if(!distanceSensor.available()){
delay(1);
return;
}

float distance = distanceSensor.get();

if(isnan(distance)){
#ifdef DEBUG
Serial.println("Distance is NAN");
Expand Down

0 comments on commit e106ef8

Please sign in to comment.