digitalRead reads LOW even though it should be HIGH

I have a problem which I honestly don’t understand(it’s probably a silly mistake also;-)).
I got a circuit mounted on a protoshield consisting of a DIP switch which is attached to some I/O pins of my arduino, they’re all pulled down with a 10k resistor, each switch got their own pull down resistor. When I write a simple sketch which just prints the digitalRead(dip_switch_pin) to the serial it always reads 0, the funny part is when I measure the voltage for that specific pin I got a 3.3V reading when the switch is on and 0V when it’s off, which in my world seems okey and therefore I should get correct readings. Can someone tell me what’s going on here?

See attachment for the actual circuit.


Well the wiring looks OK, and your measurement seems correct, so that leaves your sketch code. Post and let us look at it.

Which Arduino are you using? Why are you connecting the switches to 3.3V, unless you have a 3.3V Arduino?

Oh I should have written it down, I'm using the DUE so thats the reason why 3.3V is used.

Okey it was a stupid programmatical error, all I needed to do was to set pinMode to input. This is however strange cause according to the documentation pins on the arduino defaults to input so they doesn't hav to be excplicitly declared as input with pinMode, and this usually works for me. But in this case I needed to set pin mode for it to work.

pins on the arduino defaults to input

Possibly this is not literally true for the Due

Yeah it seems like it's not


pins on the arduino defaults to input

Possibly this is not literally true for the Due

The Due has been out now for quite a while and I don't recall ever reading about having to set pins to input mode. However I don't have any direct experience with the Due. Can anyone nail this down as if true then the arduino reference for pinMode() should reflect that behavior on a Due?

I agree with retrolefty, this should be nailed down as the documentation says that you don't have to excplicitly setpinmode to input as the pins defaults to input. This has only happened to me while working with the DUE, never when I'm coding with the UNO.