Last active
January 7, 2022 22:27
-
-
Save festlv/93b178044fc5b1fa80f634c505f2c49c to your computer and use it in GitHub Desktop.
air-guard main.py exploratory prototype
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
from sargs import * | |
# Pārbaude pēc ieslēgšanās: ieslēdzam visas gaismas diodes pēc kārtas | |
pins = [LED_ZALS, LED_DZELTENS, LED_SARKANS, LED_KREISA_ACS, LED_LABA_ACS] | |
for p in pins: | |
p.ieslegt() | |
pagaidit(0.5) | |
# Nedaudz uzgaidot, izslēdzam visas gaismas diodes apgrieztā kārtībā | |
pagaidit(1) | |
for p in reversed(pins): | |
p.izslegt() | |
pagaidit(0.5) | |
while True: | |
merijums = CO2_SENSORS.veikt_merijumu() | |
apstradat_merijumu(merijums) | |
for pin in [LED_ZALS, LED_DZELTENS, LED_SARKANS]: | |
pin.izslegt() | |
if merijums is None: | |
# Sensors iesilst, nedaram neko | |
elif merijums < 500: | |
LED_ZALS.ieslegt() | |
elif merijums < 1000: | |
LED_DZELTENS.ieslegt() | |
elif merijums > 1000: | |
LED_SARKANS.ieslegt() | |
pagaidit(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment