I just downloaded the MCP23S17 library from GITHUB and installed it. I am making an SPI interface for a 16 input relay board. I wrote a little sequencer routine (borrowing heavily from the for loop example) and found after several minutes of head scratching that somehow the constant OUTPUT is defined as a 1 and INPUT is defined as 0. I looked in MCP23S17.cpp and they are defined correctly as OUTPUT =0 and INPUT=1. Anyone have an idea why when I use pinMode as below it works but RelayBoard.pinMode(thisPin,OUTPUT); doesn't
...........................................................
#include <SPI.h>
#include <MCP23S17.h>
MCP RelayBoard(0); //Instantiate the MCP23S17 at address 0 A0=0, A1=0, A2=0
int timer = 200; // The higher the number, the slower the timing.
void setup() {
// use a for loop to initialize each pin as an output:
for (int thisPin = 1; thisPin < 9; thisPin++) {
RelayBoard.pinMode(thisPin, LOW); //for some reason OUTPUT is defined as a 1 and INPUT as a 0
// even though MCP23S17.cpp has defines that are the reverse of that. (as they should be)
............................................................
I can use INPUT or LOW or 0 and the sketch works
are theMCP23S17.cpp defines maybe being overridden by another define that I haven't found in some other include?