Hi all,
I'm doing a school project where I need to be reading data from 8 sensors and writing data to 8 LEDs. To accomplish this I'm using the Tiva C-series launchpad and 2 pcf8547n I/O expanders. I've managed to read values from one pcf correctly, however, I'm having trouble writing to the other to turn the LEDs on.
The code in the if(mode) block is for reading from the sensors which is working correctly. In the else portion of that loop is where I'm trying to write. I have address pins A2 and A1 set to ground and A0 set to Vcc on the LED pcf which should correspond to a slave address of 0x21 (stored in slaveAddLED). For testing, I have an LED connected to the P0 pin and I'm simply trying to write a 1 to that pin (0x01) to turn the LED on. Here is the code.
In addition, from what I've been reading it seems you can connect both pcf's on the same I2C bus, but I'm not sure how this works with the I2CSlaveInit() command. Do I simply initialize both slave addresses (0x20 and 0x21) onto the I2C0_BASE? When I tried this it didn't seem to work.
Thank you for any help possible.