23 lines
527 B
Python
23 lines
527 B
Python
|
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")
|