Create fan.py
This commit is contained in:
parent
aa23d66bd2
commit
1a9eb04de1
23
scripts/fan.py
Normal file
23
scripts/fan.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
import smbus
|
||||||
|
import sys
|
||||||
|
|
||||||
|
state = str(sys.argv[1])
|
||||||
|
|
||||||
|
bus = smbus.SMBus(1)
|
||||||
|
|
||||||
|
DEVICE_ADDRESS = 0x0d
|
||||||
|
|
||||||
|
def fan(state):
|
||||||
|
if state == 'off':
|
||||||
|
bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00)
|
||||||
|
bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00)
|
||||||
|
if state == 'on':
|
||||||
|
bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01)
|
||||||
|
bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01)
|
||||||
|
|
||||||
|
fan(state)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue