init converting project from micro python to c
This commit is contained in:
parent
4edd5b1cc2
commit
512e041717
32 changed files with 372 additions and 21 deletions
27
old_micro_python_code/CIRCUITPY/code.py
Executable file
27
old_micro_python_code/CIRCUITPY/code.py
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
import time
|
||||
from weather_station.pubsub import PubSub
|
||||
from weather_station.timer import Timer
|
||||
from weather_station.bme280 import BME280
|
||||
from weather_station.airlift import AirLift
|
||||
|
||||
pubsub = PubSub()
|
||||
airlift = AirLift(pubsub)
|
||||
bme280 = BME280(pubsub)
|
||||
timers = [
|
||||
Timer(pubsub, 120),
|
||||
]
|
||||
|
||||
while True:
|
||||
try:
|
||||
airlift.mqtt_client.loop()
|
||||
for timer in timers:
|
||||
t = time.time()
|
||||
timer.tick(t)
|
||||
except (ValueError, RuntimeError, ConnectionError) as e:
|
||||
print("Ran into problem\n", e)
|
||||
airlift.esp.reset()
|
||||
time.sleep(5)
|
||||
airlift.connect()
|
||||
airlift.mqtt_client.reconnect()
|
||||
time.sleep(5)
|
||||
continue
|
||||
Loading…
Add table
Add a link
Reference in a new issue