Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/PinsonJonas/MPL3115A2_MicroPython
https://github.com/PinsonJonas/MPL3115A2_MicroPython
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/PinsonJonas/MPL3115A2_MicroPython
- Owner: PinsonJonas
- License: mit
- Created: 2019-01-23T15:03:47.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-28T21:56:16.000Z (about 3 years ago)
- Last Synced: 2024-04-22T12:36:27.851Z (7 months ago)
- Language: Python
- Size: 5.86 KB
- Stars: 4
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-micropython - MPL3115A2_MicroPython - MicroPython library for the MPL3115A2 altimeter. (Libraries / Sensors)
README
# This is a MicroPython library for the MPL3115A2 Altimeter
## How to use this library
E.g. on the ESP32 pin 21 is SDA and pin 22 is SCL
Create a I2C object with the pins according to your design.
from machine import I2C
i2cbus = I2C(sda=Pin(21), scl=Pin(22))Create the MPL object in altitude mode (mode 0)
from mpl3115a2 import MPL3115A2
mpl = MPL3115A2(i2cbus, mode=MPL3115A2.ALTITUDE)to read the altitude and temperature
altitude = mpl.altitude()
temperature = mpl.temperature()
Create the MPL object in pressure mode (mode 1)from mpl3115a2 import MPL3115A2
mpl = MPL3115A2(i2cbus, mode=MPL3115A2.PRESSURE)to read the pressure and temperature
pressure = mpl.pressure()
temperature = mpl.temperature()