Digital In (button) behaves different with Shield Shield

Using the photon on it’s own to detect a button input from pin D2 by pulling down to ground seems to work fine on the breadboard.

I’ve configured it as: pinMode(pin2, INPUT_PULLUP);

However when connected my photon to the shield shield it no longer operates that way. It’ll automatically assume that D2 is TRUE and I can no longer get a change in the value when I connect/disconnect from D2 to ground.

Any suggestions on how to remedy this situation?

Thanks!

You can try INPUT pin mode and an external pull-up. The problem you are seeing has most likely to do with the 3.3V <-> 5V level shifters.

BTW, double check that you are actually using D2. The pin numbers on top of the Shield Shield represent the Arduino pin numbers, the Photon pin numbers are printed on the bottom.

1 Like

Pin 11 is D2 on the shield shield header connector.
I’m hooking up directly to D2 Pin on the photon.

I connected a 1Mohm resistor between 5V and pin11 (d2) and configured D2 as straight input --> pinMode(chargerCable, INPUT);

Still not working… i tried three resistors in series for 3Mohm, voltage between D2 and Gnd is 1.8V.

What’s the threshold for high input? is it anything above 3.3v / 2 = 1.65v?
If I pull D2 to ground the input remains high.

I guess 1MOhm was too high of impedance, a 5.5K does the trick…