Help: BME280 sensor test to Electron


I’m trying to do a test of a BME280 sensor to an Electron and I’m getting this error on compiling:

lib/Adafruit_BME280/Adafruit_BME280.h:27:23: WProgram.h: No such file or directory

This is the sketch I’m using:

// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_BME280.h>

SYSTEM_MODE(MANUAL);            //at this stage no WiFi or Cloud connection is required

#define SEALEVELPRESSURE_HPA (1013.25)  //constant for altitude calculation

Adafruit_BME280 bme(BME_CS);    //instantiate object hardware SPI

void setup()
    Serial.println("BME280 test");
    if (!bme.begin()) {Serial.println("Could not find a valid BME280 sensor, check wiring!"); while (1);}   //bme object could not be initialised
// Check and print values and wait/delay for 2 seconds
void loop()
    Serial.print("Temperature = ");
    Serial.println(" *C");

    Serial.print("Pressure = ");

    Serial.print(bme.readPressure() / 100.0F);
    Serial.println(" hPa");

    Serial.print("Approx. Altitude = ");
    Serial.println(" m");

    Serial.print("Humidity = ");
    Serial.println(" %");


For the wiring I have a BME280 with the SDA to D0 and SCL to D1

I don’t have a lot of experience with coding, but I’m trying to build this sensor for a farm. Any help is much appreciated. Thanks

What device OS version are you targeting?
I guess it’s some older version, try 1.2.1

Also, what BME280 breakout or board are you using?