Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/informaticore/toit-dps368
DPS368 Pressure Sensor Driver for Toit-lang
https://github.com/informaticore/toit-dps368
Last synced: about 2 months ago
JSON representation
DPS368 Pressure Sensor Driver for Toit-lang
- Host: GitHub
- URL: https://github.com/informaticore/toit-dps368
- Owner: Informaticore
- License: mit
- Created: 2022-04-11T21:52:01.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-16T08:23:00.000Z (8 months ago)
- Last Synced: 2024-05-16T09:35:54.559Z (8 months ago)
- Language: Toit
- Size: 22.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# toit-dps368
Library to control a DPS368 Pressure Sensor with toitlang## Install
To install the package run
```
jag pkg install dps368
```## Getting Started
```
import gpio
import i2c
import dps368
import dps368.config as cfgmain:
bus := i2c.Bus
--sda=gpio.Pin 21
--scl=gpio.Pin 22device := bus.device dps368.I2C_ADDRESS_PD
dps368 := dps368.DPS368 device
dps368.init cfg.MEASURE_RATE.TIMES_4 cfg.OVERSAMPLING_RATE.TIMES_64 cfg.MEASURE_RATE.TIMES_4 cfg.OVERSAMPLING_RATE.TIMES_1sleep --ms=100
dps368.measureContinousPressureAndTemperatureprint "ProductId: $dps368.productId"
print "Config: $dps368.measure_config"
while true:
print "$(%.2f dps368.pressure) pA"
print "$(%.2f dps368.temperature) °C"
sleep --ms=1000
```## Run tests
To run all tests you can use
```
toit run --no-device tests/run_all.toit
```