For sure. This is from the writeup I found for the specific HAT system I have.
http://wiki.52pi.com/index.php?title=Doc...oldid=5501
I can do a direct control from a terminal with this
Ch1 relay ON
<code>i2cset -y 1 0x10 0x01 0xFF </code>
CH1 relay OFF
<code>i2cset -y 1 0x10 0x01 0x00</code>
Or by running my .py file
My ch1on.py looks like this:
<code>
import time as t
import smbus
import sys
DEVICE_BUS = 1
DEVICE_ADDR = 0x10
bus = smbus.SMBus(DEVICE_BUS)
bus.write_byte_data(DEVICE_ADDR, 1, 0xFF)
sys.exit()
</code>
My ch1off.py file looks like this:
<code>
import time as t
import smbus
import sys
DEVICE_BUS = 1
DEVICE_ADDR = 0x10
bus = smbus.SMBus(DEVICE_BUS)
bus.write_byte_data(DEVICE_ADDR, 1, 0x00)
sys.exit()
</code>
My original design is using this style in a cron job as an alarm and it has worked just fine. (except I have alarm1, alarm2, etc)
But my next project is a 16 channel sprinkler system and I wanted a user interface for it as its for my neighbor and he needs to be able to modify the times himself. This seemed like a great solution as long as I can get the program to actuate my relays
http://wiki.52pi.com/index.php?title=Doc...oldid=5501
I can do a direct control from a terminal with this
Ch1 relay ON
<code>i2cset -y 1 0x10 0x01 0xFF </code>
CH1 relay OFF
<code>i2cset -y 1 0x10 0x01 0x00</code>
Or by running my .py file
My ch1on.py looks like this:
<code>
import time as t
import smbus
import sys
DEVICE_BUS = 1
DEVICE_ADDR = 0x10
bus = smbus.SMBus(DEVICE_BUS)
bus.write_byte_data(DEVICE_ADDR, 1, 0xFF)
sys.exit()
</code>
My ch1off.py file looks like this:
<code>
import time as t
import smbus
import sys
DEVICE_BUS = 1
DEVICE_ADDR = 0x10
bus = smbus.SMBus(DEVICE_BUS)
bus.write_byte_data(DEVICE_ADDR, 1, 0x00)
sys.exit()
</code>
My original design is using this style in a cron job as an alarm and it has worked just fine. (except I have alarm1, alarm2, etc)
But my next project is a 16 channel sprinkler system and I wanted a user interface for it as its for my neighbor and he needs to be able to modify the times himself. This seemed like a great solution as long as I can get the program to actuate my relays