bh3a-Icetruck-Challenge-1-3/Pi-py-Code/lüfter.py

23 lines
527 B
Python
Raw Normal View History

2024-06-27 11:14:28 +02:00
import time
from smbus import SMBus
addr = 0x8 # bus address
bus = SMBus(1) # indicates /dev/ic2-1
def luefter(state):
if (state==1):
bus.write_byte(addr, 70 ) # send F # send L / 76
elif(state==0):
bus.write_byte(addr, 102 ) #send f # send l / 108
time.sleep(0.1)
if __name__ == "__main__":
# Tur Fan on
luefter(1)
print("turn on Luefter")
time.sleep(10)
#Turn Luefter off
luefter(0)
print("turn luefter off")