-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add concept of additional sensors and add SCD41
- Loading branch information
1 parent
832162c
commit faca48c
Showing
3 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import time | ||
|
||
import breakout_scd41 | ||
|
||
from enviro import i2c | ||
|
||
breakout_scd41.init(i2c) | ||
breakout_scd41.start() | ||
|
||
def get_sensor_readings(seconds_since_last): | ||
retries = 25 | ||
while retries > 0 and not breakout_scd41.ready(): | ||
time.sleep(0.2) | ||
retries -= 1 | ||
|
||
if retries == 0: | ||
return {} | ||
|
||
scd_co2, scd_temp, scd_humidity = breakout_scd41.measure() | ||
|
||
from ucollections import OrderedDict | ||
return OrderedDict({ | ||
"scd_co2": scd_co2, | ||
"scd_temperature": scd_temp, | ||
"scd_humidity": scd_humidity | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters