Numerous 'unsupported operand type(s)' errors in barometer example

I cannot copy/paste because this is not written from the pi.

when running I get errors when trying to read temperature/pressure/altitude

As an example from line 28 temp=bmp.readTemperature an error is brought up in line 173 of readTemperature of

TypeError: unsupported operand type(s) for >>: ‘float’ and ‘int’

I am using Thonny IDE on a fresh card for the pi, and fresh install of your software. I also flashed the firmware of the grovepi.

I have tried this from command line using python3, as that was rumored to resolve these issues elsewhere, but it still produces this error.

Hi @gstraath,

Looks like B5 has to be wrapped around an int casting:

Try that and let me know if that works. If it does, I’ll have a PR for it.

Thank you!

I had to wrap several things in int() to get it to work properly, on lines 173, 229, 230, 240,241,260, 262

I am somewhat suspicious of the result, as my calculated information is:

temperature: 82.70C

Pressure: -44787.69 hPa

Altitude: 45677.32 m

Any clues why these values would be so wrong?

Is there a way to just get the raw data? All of the collected sensor information will be interpreted through a processing sketch, so I should be able to calculate the values from there without all of the ‘>>’ weirdness in the barometer library.

Hi @gstraath,

I think some values are probably off-set in a way that returns these odd values. Let me try it on mine tomorrow and see where it goes. If I see something wrong with it, I’ll try to have a fix for it and a PR.

Thank you!

I discovered that this is a BME280 sensor from SEEED, which is not officially supported by the Grovepi.

HOWEVER, you can install THIS Adafruit example and library to access the barometer properly:

(use sudo python3 install if you are using python3)

With these I can get proper information.

Hi @gstraath,

We have fixed the problem with the library. It seems like there was just a small problem with it when running it with Python 3 instead of 2. In Python 3, explicit type casting is required as opposed to the 2.

This is the PR we have done:

And if you want to update it to the latest, just use:

curl -kL | bash

And just the moment I was writing this message I realized you said you have a BMP280 and not the 180. Well, at least, we have fixed a bug.

Thank you!

well, glad to help you fix a bug. Like I said, I found a solution for the BMP280 and it works fine.