help us with Arduino nano 33 ble sense IDE Code for blinking led’s when barometric pressure goes above 94kpa
#include <Arduino_LPS22HB.h>
#define BLUE 24
#define GREEN 23
#define LED_PWR 25
void setup() {
pinMode(BLUE, OUTPUT);
Serial.begin(9600);
while (!Serial);
if (!BARO.begin()) {
Serial.println("Failed to initialize pressure sensor!");
while (1);
}
}
void loop() {
// read the sensor value
float pressure = BARO.readPressure();
// print the sensor value
Serial.print("Pressure = ");
if(pressure<93.18)
{
// digitalWrite(RED, LOW); // turn the LED off by making the voltage LOW
delay(1000);
digitalWrite(BLUE, LOW); // turn the LED off by making the voltage LOW
delay(1000);
digitalWrite(BLUE, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_PWR, HIGH);
delay(1000);
digitalWrite(LED_PWR, LOW);
delay(1000);
}
Serial.print(pressure);
/*Serial.println(" kPa");
float temperature = BARO.readTemperature();
// print the sensor value
Serial.print("Temperature = ");
Serial.print(temperature);
Serial.println(" C");*/
// print an empty line
Serial.println();
// wait 1 second to print again
delay(1000);
}
is this right ? if I run this code the blue led keeps on blinking forever