Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vs4vijay committed Mar 19, 2024
1 parent 2438fbd commit a09a5d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion airsense_firmware/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define BME688_I2C_ADDR 0x77

Adafruit_BME680 bme;
// Adafruit_BME680 bme(BME688_I2C_ADDR, Wire);

void blink_led();
float calculate_aqi(Adafruit_BME680 bme);
Expand All @@ -33,13 +34,15 @@ void setup()
while (1)
;
}
blink_led();
}

void loop()
{

// Calculate Air Quality Index (AQI) using a formula
float aqi = calculate_aqi(bme);
blink_led();
Serial.print("[+] Air Quality Index (AQI): ");
Serial.println(aqi);

Expand All @@ -52,8 +55,9 @@ float calculate_aqi(Adafruit_BME680 bme)
float temperature = bme.readTemperature();
float humidity = bme.readHumidity();
float pressure = bme.readPressure() / 100.0;
// float gasResistance = bme.readGasResistance() / 1000.0;
float gas = bme.readGas() / 1000.0;
// TODO: Get Gas Resistance value from the sensor
// float gas_resistance = bme.readGasResistance() / 1000.0;

Serial.print("Temperature: ");
Serial.print(temperature);
Expand All @@ -77,6 +81,7 @@ float calculate_aqi(Adafruit_BME680 bme)

// Example calculation:
float aqi = temperature + humidity + pressure + gas;
// float aqi = temperature * humidity * pressure / gas;

return aqi;
}

0 comments on commit a09a5d5

Please sign in to comment.