Skip to content

Instantly share code, notes, and snippets.

@festlv
Last active January 7, 2022 22:27
Show Gist options
  • Save festlv/93b178044fc5b1fa80f634c505f2c49c to your computer and use it in GitHub Desktop.
Save festlv/93b178044fc5b1fa80f634c505f2c49c to your computer and use it in GitHub Desktop.
air-guard main.py exploratory prototype
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