Greetings,
So I'm having trouble getting the right flowchart in the loop part of the code below, any tips on how to do it (how and what to start with, etc... are much appreciated )
Edit: Forgot to mention that I'm also using an HC-05 to display the values with a smartphone
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include <LiquidCrystal_I2C.h>
#define BMP280_I2C_ADDRESS 0x76
Adafruit_BMP280 bmp280;
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
Serial.println(F("Arduino + BMP280")); D
if (!bmp280.begin(BMP280_I2C_ADDRESS))
{
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
while (1);
}
lcd.setCursor(0, 0);
lcd.print("Temp:");
lcd.setCursor(0, 1);
lcd.print("Pres:");
}
char text[14];
void loop()
{
float temperature = bmp280.readTemperature();
float pressure = bmp280.readPressure();
float altitude_ = bmp280.readAltitude(1013.25);
sprintf(text, "%d.%02u%cC ", (int)temperature, (int)(temperature * 100)%100, 223);
lcd.setCursor(5, 0);
lcd.print(text);
// 2: print pressure
sprintf(text, "%u.%02u hPa ", (int)(pressure/100), (int)((uint32_t)pressure % 100));
lcd.setCursor(5, 1);
lcd.print(text);
Serial.print("Temperature = ");
Serial.print(temperature);
Serial.println(" °C");
Serial.print("Pressure = ");
Serial.print(pressure/100);
Serial.println(" hPa");
Serial.print("Approx Altitude = ");
Serial.print(altitude_);
Serial.println(" m");
Serial.println();
delay(2000);
}