To this end I bought an already made 128 I2C GPIO Expander 8*MCP23017, and 8 * 16 Channel Relay Board.
The expander works as it should, the relays not so much, so I'm actually testing now using an 8 Channel Relay Board.
My problems come in programming the MCP23017, more exactly how to use just one specific pin.
I've managed to activate all the pins, but when it comes to just 1 - this eludes me completely.
Keep in mind that the relay board activates on LOW and deactivates on HIGH.
I've checked the specs on the MCP23017 several times, but still I cannot seem to find the specific addresses for each pin..
Code: Select all
import smbus import sys import getopt import time bus = smbus.SMBus(1) address = 0x20 bus.write_byte_data(0x20, 0x00, 0x00) #set Port-A as output #Relay turns ON time.sleep(1) bus.write_byte_data(0x20, 0x12, 0xFF) #set Port-A to High #Relay turns OFF
Thanks for reading this
Edit: http://ww1.microchip.com/downloads/en/d ... 01952c.pdf MCP23017 Datasheet