I have just got a nano 33 IoT and have been struggling to get consistent functionality for a simple set of internal_pullup switched on the digital pins.
I set all of the pins to pinMode(n, INPUT_PULLUP); [where n is the pin number from 0 - 13]. When I digitalRead(n) each of the pins i get the following:
D0
D1
D2
D3
D4
D5
D6
D7
D8
D9
D10
D11
D12
D13
digitalRead(pin)
1
1
0
1
0
1
1
0
0
1
1
1
1
1
The only relationship I can see is that on the screen print of the pin names on the board I notice that D4, D7, D8 all lack a little dash below their name but all the other pins have one.
But then to confuse matters pin D2 does have a dash under its name which would suggest logically that it should read high not low.
OK, that is a useful bit of info and something common for those pins that are not responding as expected - is it the case that a digital pin without PWM capability cannot be set to INPUT_PULLUP
or something of that nature?
I just did a quick test on my Arduino Nano 33 IoT. I switched every pin to Output LOW first for 5ms and then switched to Input with pullup and read the pin the next instruction.
Every pin read 0 when output low and 1 when input pullup as expected.
Yeah - given the low-cost of these components I find it's often easier to just swap-out enough things until it works and then swap things back to find which component(s) stop it working. It's usually shortly after that I have an "ah-ha" moment.
Might also be an interesting insight to set those pins high as outputs and then see if they go high (and perhaps test them with a physical pullup/down resistor) - could just be that the input has had a good static zap and is non-functional?