I get the following error when compiling.
C:\Users\marks\OneDrive\Documents\Arduino\bme280FirstTest\bme280FirstTest.ino:7:28: fatal error: AdafruitSensor.h: No such file or directory
compilation terminated.
exit status 1
Compilation error: AdafruitSensor.h: No such file or directory
This seems like it should be a simple problem to solve, but I have been stumped. The sketch is below.
any help would be appreciated!!!!!!
Mark Soldate
Mod edit: Email address removed.
#include <Wire.h>
#include <AdafruitSensor.h>
#include <AdafruitBME280.h>
/the following for SPI only
include <SPI.h>
#define BME_SCK 18d
#define BME_MISO 19
#define BME_MOSI 23
#define BME_CS 5/
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI
unsigned long delayTime;
void setup() {
Serial.begin(9600);
Serial.println(F("BME280 test"));
bool status;
// default settings
// (you can also pass in a Wire library object like &Wire2)
status = bme.begin(0x76); // 0x76 is the default address for BME280 transducer
Summary
This text will be hidden
// the secondary address is 0x77
if (!status) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
Serial.println("-- Default Test --");
delayTime = 1000;
Serial.println();
}
void loop() {
printValues();
delay(delayTime);
}
void printValues() {
Serial.print("Temperature = ");
Serial.print(bme.readTemperature());
Serial.println(" *C");
Convert temperature to Fahrenheit
Serial.print("Temperature = ");
Serial.print(1.8 * bme.readTemperature() + 32);
Serial.println(" *F");
Serial.print("Pressure = ");
Serial.print(bme.readPressure() / 100.0F);
Serial.println(" hPa");
Serial.print("Approx. Altitude = ");
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(" m");
Serial.print("Humidity = ");
Serial.print(bme.readHumidity());
Serial.println(" %");
Serial.println();
}
