0% found this document useful (0 votes)
78 views2 pages

Sensor Bmp280

The document declares two BME280 sensor objects to read temperature, humidity, and pressure values from two sensors. It initializes the sensors, reads values from each sensor, and writes the values to virtual pins on the Blynk platform for visualization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views2 pages

Sensor Bmp280

The document declares two BME280 sensor objects to read temperature, humidity, and pressure values from two sensors. It initializes the sensors, reads values from each sensor, and writes the values to virtual pins on the Blynk platform for visualization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include "cactus_io_BME280_I2C.

h"

BME280_I2C BME280Sensor01(0x77);
float BME280Sensor01Pres;
float BME280Sensor01Hum;
float BME280Sensor01Temp;
float BME280Sensor01DewPoint;

BME280_I2C BME280Sensor02(0x76);
float BME280Sensor02Pres;
float BME280Sensor02Hum;
float BME280Sensor02Temp;
float BME280Sensor02DewPoint;

void setup()
{
if (!BME280Sensor01.begin())
{
Serial.println("Could not find a First BME280 sensor, check wiring!");
while (1);
}

if (!BME280Sensor02.begin())
{
Serial.println("Could not find a Second BME280 sensor, check wiring!");
while (1);
}
}

void runBMESensors()
{
BME280Sensor01.readSensor();
BME280Sensor01Pres = BME280Sensor01.getPressure_MB();
BME280Sensor01Hum = BME280Sensor01.getHumidity();
BME280Sensor01Temp = BME280Sensor01.getTemperature_C();
BME280Sensor01DewPoint = dewPoint(BME280Sensor01Temp, BME280Sensor01Hum);

Blynk.virtualWrite(V49, BME280Sensor01Pres);
Blynk.virtualWrite(V33, BME280Sensor01Hum);
Blynk.virtualWrite(V29, BME280Sensor01Temp);
Blynk.virtualWrite(V47, BME280Sensor01DewPoint);

if (debug) {
Serial.print("BME 1\t");
Serial.print(BME280Sensor01Pres); Serial.print("\t\t"); // Pressure in
millibars
Serial.print(BME280Sensor01Hum); Serial.print("\t\t");
Serial.print(BME280Sensor01Temp); Serial.println(" *C\t");
Serial.print(BME280Sensor01DewPoint); Serial.println(" *C\t");
}

BME280Sensor02.readSensor();
BME280Sensor02Pres = BME280Sensor02.getPressure_MB();
BME280Sensor02Hum = BME280Sensor02.getHumidity();
BME280Sensor02Temp = BME280Sensor02.getTemperature_C();
BME280Sensor02DewPoint = dewPoint(BME280Sensor02Temp, BME280Sensor02Hum);

Blynk.virtualWrite(V72, BME280Sensor02Pres);
Blynk.virtualWrite(V59, BME280Sensor02Hum);
Blynk.virtualWrite(V53, BME280Sensor02Temp);
Blynk.virtualWrite(V71, BME280Sensor02DewPoint);

if (debug) {
Serial.print("BME 2\t");
Serial.print(BME280Sensor02Pres); Serial.print("\t\t"); // Pressure in
millibars
Serial.print(BME280Sensor02Hum); Serial.print("\t\t");
Serial.print(BME280Sensor02Temp); Serial.println(" *C\t");
Serial.print(BME280Sensor02DewPoint); Serial.println(" *C\t");
}
}

You might also like