kuukar-rpi/test_sensors.py

16 lines
523 B
Python
Raw Normal View History

2022-11-04 04:58:20 +00:00
import time
from telemetrix_rpi_pico import telemetrix_rpi_pico
import kuukar.kuukar_sensors as kuukar_sensors
mcu = telemetrix_rpi_pico.TelemetrixRpiPico()
sensors = kuukar_sensors.sensors(mcu)
while True:
temp = sensors.get_temperature()
humid = sensors.get_humidity_pct()
dist1 = sensors.sonar_get_distance(0)
dist2 = sensors.sonar_get_distance(1)
dist3 = sensors.sonar_get_distance(2)
print(f'temp: {temp}, humidity: {humid}, dist1: {dist1}, dist2: {dist2}, dist3: {dist3}')
time.sleep(1)