File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -99,8 +99,26 @@ Or the following command to update an existing version:
99
99
Usage Example
100
100
=============
101
101
102
- .. todo :: Add a quick, simple example. It and other examples should live in the
103
- examples folder and be included in docs/examples.rst.
102
+ .. code-block :: python
103
+
104
+ import time
105
+ import board
106
+ import adafruit_scd4x
107
+
108
+ i2c = board.I2C()
109
+ scd4x = adafruit_scd4x.SCD4X(i2c)
110
+ print (" Serial number:" , [hex (i) for i in scd4x.serial_number])
111
+
112
+ scd4x.start_periodic_measurement()
113
+ print (" Waiting for first measurement...." )
114
+
115
+ while True :
116
+ if scd4x.data_ready:
117
+ print (" CO2: %d ppm" % scd4x.CO2 )
118
+ print (" Temperature: %0.1f *C" % scd4x.temperature)
119
+ print (" Humidity: %0.1f %% " % scd4x.relative_humidity)
120
+ print ()
121
+ time.sleep(1 )
104
122
105
123
Contributing
106
124
============
You can’t perform that action at this time.
0 commit comments