Bosch BME280 driver
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Bosch BME280 driver
Given that those measurements were spread over ten hours it seems likely that the pressure might have changed by +0.43 -0.24 millibar over the period. My graphing barometer shows rates of change two orders of magnitude faster occurred in the last week.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Bosch BME280 driver
[code]
MicroPython v1.9.2 on 2017-08-23; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> import machine
>>> import bme280
>>> i2c = machine.I2C(2)
>>> bme = bme280.BME280(i2c = i2c)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bme280.py", line 185, in __init__
File "bme280.py", line 191, in _load_calibration
File "bme280.py", line 151, in readU16LE
File "bme280.py", line 134, in readU16
TypeError: function missing 1 required positional arguments
>>> i2c = machine.I2C(scl='Y9',sda='Y10')
>>> bme = bme280.BME280(i2c = i2c)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bme280.py", line 185, in __init__
File "bme280.py", line 191, in _load_calibration
File "bme280.py", line 151, in readU16LE
File "bme280.py", line 134, in readU16
TypeError: function missing 1 required positional arguments
[/code]
keep getting this error when trying to use the driver, i2c.scan() reports the address is 118.
MicroPython v1.9.2 on 2017-08-23; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> import machine
>>> import bme280
>>> i2c = machine.I2C(2)
>>> bme = bme280.BME280(i2c = i2c)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bme280.py", line 185, in __init__
File "bme280.py", line 191, in _load_calibration
File "bme280.py", line 151, in readU16LE
File "bme280.py", line 134, in readU16
TypeError: function missing 1 required positional arguments
>>> i2c = machine.I2C(scl='Y9',sda='Y10')
>>> bme = bme280.BME280(i2c = i2c)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bme280.py", line 185, in __init__
File "bme280.py", line 191, in _load_calibration
File "bme280.py", line 151, in readU16LE
File "bme280.py", line 134, in readU16
TypeError: function missing 1 required positional arguments
[/code]
keep getting this error when trying to use the driver, i2c.scan() reports the address is 118.
Re: Bosch BME280 driver
The from_bytes() method is missing the second argument, which must be "little". So the two lines 133.134 should read:
Similar in the functions readRaw8() (line 115) and readU8() (line120). That was not required in earlier versions of MicroPython.
Code: Select all
result = int.from_bytes(
self._i2c.readfrom_mem(self._address, register, 2), 'little' ) & 0xFFFF