Digital Outputs
Digital Inputs
BOAT IO has two isolated outputs that can be used to control external devices. The outputs are controlled by an I2C device, PCF9536. Each output is protected by a 0.5A fuse.
Python Test Program
import smbus
import time
from os import system
bus=smbus.SMBus(1)
**** Digital Output
PCA9536=0x41 #7 bit address (will be shifted to add the read/write bit)
LED1 = 0x04
LED2 = 0x08
OUT1 = 0x01
OUT2 = 0x02
def PCA9536_init():
# set register 3 to all outputs
bus.write_byte_data(PCA9536,3,0x00)
#turn off all outputs
bus.write_byte_data(PCA9536,1,0xFF)
def PCA9536_output(out):
# flip the bits
out = (0xFF ^ out) & 0x0F
#print "out:",out
bus.write_byte_data(PCA9536,1,out)
***** Initialize the devices
PCA9536_init()
while True:
print "LED1"
PCA9536_output(LED1)
time.sleep(2)
print "LED1+LED2"
PCA9536_output(LED2+LED1)
time.sleep(2)
print "LED1+LED2+OUT1"
PCA9536_output(OUT1+LED2+LED1)
time.sleep(2)
PCA9536_output(OUT1|LED2|LED1)