I’m able to read the limit switches 1 and 2 on port 3 perfectly.
In an effort to try to understand on which pins the limit switches 3 and 4 appear to the Arduino I tried to read them from port 7. According to the docs. But I could only ever read one of the limit switches. According to the back of the board they should be on A1 and A6. I was only ever able to read both switches using port 6, which contains A3 and A2.
Port 6 of A3 and A2 both work
Port 7 of A1 and A6 only A1 works
Port 8 of A0 and A7 only A0 works
In the code which follows I changed the A1 and A6 to the combinations shown above.
void setup()
{
Serial.begin(9600);
pinMode (A4,INPUT_PULLUP);
pinMode (A5,INPUT_PULLUP);
Serial.println("start");
}
int iOldY1 = 0 ;
int iOldY2 = 0 ;
void loop()
{
int iNewY1 = digitalRead (A4) ;
int iNewY2 = digitalRead (A5) ;
// Only show when a change happens...
if ((iNewY1 != iOldY1) || (iNewY2 != iOldY2)) {
Serial.print ("A4=") ;
Serial.print (iNewY1) ;
Serial.print (" A5=") ;
Serial.print (iNewY2) ;
Serial.println("") ;
}
iOldY1 = iNewY1 ;
iOldY2 = iNewY2 ;
}
So either the docs are wrong and limit switches are not on port 7, or only half of port 7 is working, or…?