void setup() {
// put your setup code here, to run once:
#include <Wire.h>
#include <Adafruit_Sensor.h>
//Define the pins for the BME280 sensor//
const int bmeSck = 13;
const int bmeMiso = 12;
const int bmeMosi = 11;
const int bmeCs = 10;
// Create an instance of the BME280 sensor
void setup() {
// Initialize the serial communication
Serial.begin(9600);
// Initialize the BME280 sensor
bme.begin(bmeCs, bmeMosi, bmeMiso, bmeSck);
}
void loop() {
// Read the temperature, humidity, and pressure values
float temperature = bme.readTemperature();
float humidity = bme.readHumidity();
float pressure = bme.readPressure();
// Print the values to the serial monitor
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println("°C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println("%");
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.println("hPa");
// Wait for 1 second before taking the next reading
delay(1000);
}
}
Appiah Michael Anni 1693677408
Amissah Isaiah Frimpong 1705400441