Compile error ddddd

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();
}

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

Hi @testengr,

unfortunately your code is not included in "code tags". That makes it hard to read. Please use

image

this button to get a space where the sketch should be inserted.

P.S.: If you compare your sketch with the Adafruit example

https://github.com/adafruit/Adafruit_BME280_Library/blob/master/examples/bme280test/bme280test.ino

you will identify some typos in your code:

Example:

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

Your sketch:

#include <Wire.h>
#include <AdafruitSensor.h>
#include <AdafruitBME280.h>