bh3a-Icetruck-Challenge-1-3/Pi-py-Code/cooling.py
2024-06-27 11:14:28 +02:00

23 lines
590 B
Python

from tmp_0x09 import get_temp
from lüfter import luefter
from gasventile import gasventile
from protocoll import insert_data
def apply_cooling():
try:
temp_sensor= ((get_temp(0x09)+get_temp(0x0a)+get_temp(0x0b))/3)
except ZeroDivisionError:
temp_sensor=0
#insert_data(temp_sensor, 1)
if (temp_sensor < -5):
luefter(0)
elif (temp_sensor < 10):
luefter(1)
else:
luefter(1)
gasventile(5)
print (temp_sensor)
if __name__ == '__main__':
apply_cooling()