Post a link to the display and the code that does not work and I will take a look.
The sketch I am using is:
Version 11_11_2018, modified for Celsius
BME280 I2C Test.ino
This code shows how to record data from the BME280 environmental sensor
using I2C interface. This file is an example file, part of the Arduino
BME280 library.
GNU General Public License
/*
BME280 I2C Test.ino
This code shows how to record data from the BME280 environmental sensor
using I2C interface. This file is an example file, part of the Arduino
BME280 library.
GNU General Public License
Written: Dec 30 2015.
Last Updated: Oct 07 2017.
Connecting the BME280 Sensor:
Sensor -> Board
-----------------------------
Vin (Voltage In) -> 3.3V
Gnd (Ground) -> Gnd
SDA (Serial Data) -> A4 on Uno/Pro-Mini, 20 on Mega2560/Due, 2 Leonardo/Pro-Micro
SCK (Serial Clock) -> A5 on Uno/Pro-Mini, 21 on Mega2560/Due, 3 Leonardo/Pro-Micro
*/
#include <BME280I2C.h>
#include <EnvironmentCalculations.h>
#include <Wire.h>
#define SERIAL_BAUD 115200
/// Temperature unit enumeration.
enum TempUnit
{
TempUnit_Celsius,
TempUnit_Fahrenheit
};
BME280I2C bme; // Default : forced mode, standby time = 1000 ms
// Oversampling = pressure ×1, temperature ×1, humidity ×1, filter off,
//////////////////////////////////////////////////////////////////
void setup()
{
Serial.begin(SERIAL_BAUD);
while (!Serial) {} // Wait
Wire.begin();
while (!bme.begin())
{
Serial.println("Could not find BME280 sensor!");
delay(1000);
}
switch (bme.chipModel())
{
case BME280::ChipModel_BME280:
Serial.println("Found BME280 sensor! Success.");
break;
case BME280::ChipModel_BMP280:
Serial.println("Found BMP280 sensor! No Humidity available.");
break;
default:
Serial.println("Found UNKNOWN sensor! Error!");
}
}
//////////////////////////////////////////////////////////////////
void loop()
{
printBME280Data(&Serial);
delay(500);
}
//////////////////////////////////////////////////////////////////
void printBME280Data
(
Stream* client
)
{
float temp(NAN), hum(NAN), pres(NAN);
BME280::TempUnit tempUnit(BME280::TempUnit_Celsius);
BME280::PresUnit presUnit(BME280::PresUnit_Pa);
EnvironmentCalculations::TempUnit envTempUnit = EnvironmentCalculations::TempUnit_Celsius;
bme.read(pres, temp, hum, tempUnit, presUnit);
client->print("Temperatura: ");
client->print(temp);
client->print(" °" + String(tempUnit == BME280::TempUnit_Celsius ? 'C' : 'F'));
client->print("\t\tUmid: ");
client->print(hum);
client->print(" %RH");
client->print("\t\tPressione: ");
client->print(pres/100);
client->println(" hPa");
float heatIndex = EnvironmentCalculations::HeatIndex(temp, hum, envTempUnit);
client->print("\t\tIndice calore: ");
client->print(heatIndex);
client->println(" °C");
float dewPoint = EnvironmentCalculations::DewPoint(temp, hum, envTempUnit);
client->print("\t\tDewPoint: ");
client->println(dewPoint);
client->println("°C");
delay(1000);
}
I would like to add to the above sketch some lines of code to have its results (Temperature, Humidity, Pressure and Heat index values) on an Oled display 0.96", connected to Arduino Nano via I2C:
OLED GND - Arduino GND
OLED VCC - Arduino 5V
OLED SCL - Arduino Uno A5
OLED SDA - Arduino Uno A4
There are several Libraries for 128x32 or 128x64 Oled display, but honestly I am not able to write the code necessary to show also on the small display oled the values that are read on the Serial monitor. Even if the 0.96 "display is small, there is still enough space to show all the values - in small characters - (for example:
T: 22.56CH: 64.20% HP: 1021.34 hPa HI: 23C). I repeat, I am not good at programming, so I will greatly appreciate your help. Thank you very much for the help.