planktoscope/scripts/fan.py

19 lines
414 B
Python
Raw Normal View History

2019-12-14 00:00:20 +01:00
#!/usr/bin/python
import smbus
import sys
state = str(sys.argv[1])
bus = smbus.SMBus(1)
DEVICE_ADDRESS = 0x0d
def fan(state):
2019-12-14 10:33:17 +01:00
if state == "false":
2019-12-14 00:00:20 +01:00
bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00)
bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x00)
2019-12-14 10:33:17 +01:00
if state == "true":
2019-12-14 00:00:20 +01:00
bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01)
bus.write_byte_data(DEVICE_ADDRESS, 0x08, 0x01)
2019-12-14 10:33:17 +01:00
fan(state)