Are old libraries good for Ameba?

I use to work with libraries for sensors like this one

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

Adafruit_BME280 bme280;

uint8_t BME280_Init(uint8_t slave_addr)
{
    uint8_t result;

    Wire.setClock(400000);
    
    if (slave_addr == 0)
        result = bme280.begin();
    else
       result = bme280.begin(slave_addr);
   
    return result;
}

Now when I call BME280_Init I’m stuck, looks like a hard fault exception.

1 Like

Would you mind sharing the hard fault log printed on the Serial monitor?

There is no fault printed. When I call BME280_Init the program stops and I get no response from it. I have to reset the board.

Well…I found the problem -

Wire.setClock(400000);

This line causes the problem. It should be after begin().

1 Like

Good for you~ :slight_smile: