mcp23s17 and sumotoy gpio_MCP23S17

Status
Not open for further replies.

mah

Well-known member
Hi, i had sucess writing to the mcp, but i cant seem to read, i dont find a simple example on how to read. i messure 3.3v at the pin but my code reports 0 whatever i do. im quite certain its the code but cant a find a basic read example, anyone that could help me?

Heres my code:

Code:
#include <SPI.h>
#include <gpio_MCP23S17.h>   // import library
int va = 0;

gpio_MCP23S17 mcp(37,0x20);
void setup(){
  mcp.begin();
  
}
void loop(){

 for(int i = 0; i < 16; i++){  
    va = mcp.gpioDigitalRead(i);
    Serial.print(va);
    delay(1);
    }
delay(1000);
}
 
Status
Not open for further replies.
Back
Top