help us with Arduino IDE Code for blinking led’s when barometric pressure goes above 94kpa
#include <ML_rev_inferencing.h>
/*
LPS22HB - Read Pressure
This example reads data from the on-board LPS22HB sensor of the
Nano 33 BLE Sense and prints the temperature and pressure sensor
value to the Serial Monitor once a second.
The circuit:
- Arduino Nano 33 BLE Sense
This example code is in the public domain.
*/
#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 it correct? if I run this code the blue led keeps on blinking forever