Arduino Due - Internal pull-up resistors

Hi - I am new to using the Arduino Due and usually use the Atmel MCU.
I have an issue when setting the internal pull-up resistors on the due. Although I use the pinMode (pin, INPUT_PULLUP); command, when the state of the pin if polled it shows as LOW rather than HIGH.

Attached is my code which goes into void setup () and I'd appreciate any help.


Serial.begin(9600);           //Needs to be enabled for tuning
  Serial.println("Switch 2 toggles on/off the PID controller");
  Serial.println("Switch 3 toggles on/off the PID tuning");
  Serial.println("**Reminder** PID tuning values are not saved and must be changed manually in the code");
  pinMode(12, INPUT_PULLUP);    //Set up switch 2 as an input
  pinMode(11, INPUT_PULLUP);    //Set up switch 3 as an input
  Serial.print("Switch 2 state: ");
  Serial.print("Switch 3 state: ");
  Serial.print("Initial p_gain = ");
  Serial.print("Initial i_gain = ");
  Serial.print("Initial d_gain = ");

What is connected to pins 11 & 12 and how is it wired?

The pins are connected to switches - through to ground.

Simple test, what does it read when you disconnect the switches?

Your switches might be of the 'normally closed' type (or you have the pin connected to the NC contact of the switch).

Thank for the help - the switches were normally closed thus the reported state became inverted. Sometime you just cannot see the wood for the trees