Go Down

Topic: GY-BMP280-3.3 with Adafruit Feather Huzzah ESP8266 (Read 491 times) previous topic - next topic

pshankland

Hi, I have purchased a cheap BMP280 sensor off eBay which has the part number "GY-BMP280-3.3". I am trying to get this to work via I2C on my Adafruit Feather Huzzah ESP8266.

I have the following connected (BMP280 to Feather):

VCC --> 3V
GND --> GND
SCK/SCL --> SCL/5
SDA/SDI --> SDA/4

I have loaded the I2C-Sensor-Lib iLib library within the Arduino IDE and tried to use the BMP280 example (listed below) but just keep getting this error:

Quote
Arduino: 1.8.1 (Windows 7), Board: "Adafruit HUZZAH ESP8266, 80 MHz, 115200, 4M (3M SPIFFS)"

Build options changed, rebuilding all
In file included from sketch\i2c_BMP280.ino.cpp:1:0:

C:\Peter\OneDrive\Pete's Documents\Arduino\libraries\I2C-Sensor-Lib_iLib\src/i2c.h: In constructor 'WirePlus::WirePlus()':

C:\Peter\OneDrive\Pete's Documents\Arduino\libraries\I2C-Sensor-Lib_iLib\src/i2c.h:70:12: error: 'PORTC' was not declared in this scope

     bitSet(PORTC, 4);  // deactivate internal pull-ups for twi

            ^

C:\Users\Peter\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/Arduino.h:172:30: note: in definition of macro 'bitSet'

 #define bitSet(value, bit) ((value) |= (1UL << (bit)))

                              ^

In file included from C:\Users\Peter\AppData\Local\Temp\arduino_modified_sketch_145553\i2c_BMP280.ino:2:0:

C:\Peter\OneDrive\Pete's Documents\Arduino\libraries\I2C-Sensor-Lib_iLib\src/i2c.h:73:5: error: 'TWBR' was not declared in this scope

     TWBR = ((F_CPU / 400000L) - 16) / 2; // see twi_init in Wire/utility/twi.c

     ^

exit status 1
Error compiling for board Adafruit HUZZAH ESP8266.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Code:
Quote
#include <Wire.h>
#include "i2c.h"

#include "i2c_BMP280.h"
BMP280 bmp280;

void setup()
{
    Serial.begin(115200);

    Serial.print("Probe BMP280: ");
    if (bmp280.initialize()) Serial.println("Sensor found");
    else
    {
        Serial.println("Sensor missing");
        while (1) {}
    }

    // onetime-measure:
    bmp280.setEnabled(0);
    bmp280.triggerMeasurement();
}

void loop()
{
    bmp280.awaitMeasurement();

    float temperature;
    bmp280.getTemperature(temperature);

    float pascal;
    bmp280.getPressure(pascal);

    static float meters, metersold;
    bmp280.getAltitude(meters);
    metersold = (metersold * 10 + meters)/11;

    bmp280.triggerMeasurement();

    Serial.print(" HeightPT1: ");
    Serial.print(metersold);
    Serial.print(" m; Height: ");
    Serial.print(meters);
    Serial.print(" Pressure: ");
    Serial.print(pascal);
    Serial.print(" Pa; T: ");
    Serial.print(temperature);
    Serial.println(" C");
}

/**<

Program size:
A1.0.5:
A1.5.7: 9680b
A1.6.3: 9664b / 561b

 */
Any suggestions?

Thanks.

Go Up