Skip to content

Commit

Permalink
Initial version of TFHT01 testing script.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklik committed Apr 26, 2024
1 parent bc9b1c2 commit ae9a8d6
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 530 deletions.
62 changes: 62 additions & 0 deletions sw/TFHT01_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/python

# Python library for SHT3101A MLAB module with SHT31 Temperature and relative humidity sensor.

#uncomment for debbug purposes
#import logging
#logging.basicConfig(level=logging.DEBUG)

import time
import datetime
import sys
from pymlab import config

#### Script Arguments ###############################################

if len(sys.argv) not in (2, 3):
sys.stderr.write("Invalid number of arguments.\n")
sys.stderr.write("Usage: %s PORT ADDRESS\n" % (sys.argv[0], ))
sys.exit(1)

port = eval(sys.argv[1])

if len(sys.argv) == 3:
address = eval(sys.argv[2])
else:
address = 0x44

#### Sensor Configuration ###########################################

cfg = config.Config(
i2c = {
"port": port,
"device": 'hid',
},
bus = [
{
"name": "sht",
"type": "sht31",
"address": address,
},
],
)


cfg.initialize()

print ("SHT31 sensor readout example \r\n")
sensor = cfg.get_device("sht")

#sensor.soft_reset() # TODO, not implemented in pymlab dev branch.
time.sleep(0.1)

#### Data Logging ###################################################

try:
while True:
temperature, humidity = sensor.get_TempHum()
sys.stdout.write("Sensor status: %s, Temperature: %0.2f, Humidity: %0.2f\r\n" % (sensor.get_status(), temperature, humidity))
sys.stdout.flush()
time.sleep(1)
except KeyboardInterrupt:
sys.exit(0)
139 changes: 0 additions & 139 deletions sw/arduino/SPS30MAV_small/ArduinoMavlink.cpp

This file was deleted.

39 changes: 0 additions & 39 deletions sw/arduino/SPS30MAV_small/ArduinoMavlink.h

This file was deleted.

Loading

0 comments on commit ae9a8d6

Please sign in to comment.