I2C Read Help - NCP23008 rickkas7 Library

I am using an NCD Relay board with a Photon2 plugged in via the NCD Feather to IOT. I can turn all of the relays on and off.

I also have attached the NCD PR2-8 8-channel Digital I/O IoT.
When I run the NCD sample to scan the I2C, I see the address of my two devices as 32 and 33.

I want to set all 8 to be Inputs with pull ups. I need to connect manual switches between the input pins and ground so I can read them and see when they are on.

I suppose this should be easy, but I am not having any success reading those inputs and would appreciate some direction on how to go about this. I am including the code I have pasted into the Photon2 so you can see just where I am at with this. Most grateful for any help with this!!

// This #include statement was automatically added by the Particle IDE.

#include <MCP23008-RK.h>



/* Includes ------------------------------------------------------------------*/
#include "NCD8Relay.h"
#include "spark_wiring_print.h"

MCP23008 gpio(Wire,0);

SYSTEM_MODE(AUTOMATIC);
NCD8Relay relayController;
int triggerRelay(String command);

/* This function is called once at start up ----------------------------------*/
void setup()
{
	Serial.begin(115200);
	relayController.setAddress(0,0,0);
	Spark.function("controlRelay", triggerRelay);
	
    gpio.begin();
    gpio.pinMode(0, INPUT);
    gpio.digitalWrite(0, HIGH);
     gpio.pinMode(1, INPUT);
    gpio.digitalWrite(1, HIGH);
     gpio.pinMode(2, INPUT);
    gpio.digitalWrite(2, HIGH);
     gpio.pinMode(3, INPUT);
    gpio.digitalWrite(3, HIGH);
     gpio.pinMode(4, INPUT);
    gpio.digitalWrite(4, HIGH);
     gpio.pinMode(5, INPUT);
    gpio.digitalWrite(5, HIGH);
     gpio.pinMode(6, INPUT);
    gpio.digitalWrite(6, HIGH);
     gpio.pinMode(7, INPUT);
    gpio.digitalWrite(7, HIGH);

}


/* This function loops forever --------------------------------------------*/
void loop()
{

  //  triggerRelay("1off");
 //   relayCommand("1","on");
  //  delay(2000);
  //  triggerRelay("1off");
 //   relayCommand("1","off");
  //  delay(2000);
}

int triggerRelay(String command){
	if(command.equalsIgnoreCase("turnonallrelays")){
		relayController.turnOnAllRelays();
		return 1;
	}
	if(command.equalsIgnoreCase("turnoffallrelays")){
		relayController.turnOffAllRelays();
		return 1;
	}
	if(command.startsWith("setBankStatus:")){
		int status = command.substring(14).toInt();
		if(status < 0 || status > 255){
			return 0;
		}
		Serial.print("Setting bank status to: ");
		Serial.println(status);
		relayController.setBankStatus(status);
		Serial.println("done");
		return 1;
	}
	//Relay Specific Command
	int relayNumber = command.substring(0,1).toInt();
	Serial.print("relayNumber: ");
	Serial.println(relayNumber);
	String relayCommand = command.substring(1);
	Serial.print("relayCommand:");
	Serial.print(relayCommand);
	Serial.println(".");
	if(relayCommand.equalsIgnoreCase("on")){
		Serial.println("Turning on relay");
		relayController.turnOnRelay(relayNumber);
		Serial.println("returning");
		return 1;
	}
	if(relayCommand.equalsIgnoreCase("off")){
		relayController.turnOffRelay(relayNumber);
		return 1;
	}
	if(relayCommand.equalsIgnoreCase("toggle")){
		relayController.toggleRelay(relayNumber);
		return 1;
	}
	if(relayCommand.equalsIgnoreCase("momentary")){
		relayController.turnOnRelay(relayNumber);
		delay(300);
		relayController.turnOffRelay(relayNumber);
		return 1;
	}
	return 0;
}

You need to set the pinMode to INPUT_PULLUP not INPUT. Don't call digtalWrite() on an input pin.

I highly recommend using DebounceSwitchRK if you are using switches connected to a MCP23008. The two libraries are designed to work together.

I can control the relays, but am stuck on reading from the NCD Digital IO Board.
I am trying to use the NCP23008 Rikkas7 Library along with the DebounceswitchRK Library for the NCD 8-channel Digital I/O. I'm not sure I am setting the address correct and can't seem to figure out how to read the inputs. They are set to Toggle_High. A scan shows the relay board at 32 and the I/O Board at 33. The I/O board ports are labeled 100-107. Any help and direction is most appreciated. Thanks!

There are too many variables here to tell what's wrong. I would start by using I2C Scanner firmware to make sure you have the right addresses, the connections are good, and you have the right I2C pull-up resistors.

Thank you for your assistance.

I have run I2C Scanner. It reports a Device at 32 (this is how the addr selector on the NCD relay board is set) and a Device at 33 (this is how the addr selector on the NCD 8 Channel Digital I/O) is set.

It seems the hardware is setup correctly. I can talk to the relay board to turn each relay on and off. I don't see how to set software address on the 8 Channel I/O and then read the NCD Digital I/O using the DebounceswitchRK library.

What step do you recommend next? Thanks!