File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,28 @@ To install in a virtual environment in your current project:
59
59
Usage Example
60
60
=============
61
61
62
- .. todo :: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.
62
+ .. code-block :: python
63
+
64
+ import time
65
+ import busio
66
+ import board
67
+ import adafruit_htu31d
68
+
69
+ i2c = busio.I2C(board.SCL , board.SDA )
70
+ htu = adafruit_htu31d.HTU31D(i2c)
71
+ print (" Found HTU31D with serial number" , hex (htu.serial_number))
72
+
73
+ htu.heater = True
74
+ print (" Heater is on?" , htu.heater)
75
+ htu.heater = False
76
+ print (" Heater is on?" , htu.heater)
77
+
78
+ while True :
79
+ temperature, relative_humidity = htu.measurements
80
+ print (" Temperature: %0.1f C" % temperature)
81
+ print (" Humidity: %0.1f %% " % relative_humidity)
82
+ print (" " )
83
+ time.sleep(1 )
63
84
64
85
Contributing
65
86
============
You can’t perform that action at this time.
0 commit comments