Needing more digital pins

In my application, I am already using digital pins D1-D8.

I need to add a 5V sensor (very low current). Can I use any of the A-pins?

Thanks in advance for the input.

Yes, A pins other than A3 and DAC (A6) can be used as 5 volt tolerant digital inputs. In other words, A0, A1, A2, A4, A5, and WKP are 5 volt tolerant.

If you don’t need Serial1, TX and RX can also be used as 5 volt tolerant digital inputs.

And if you need even more, an I2C GPIO expander works well. The MCP23017 adds 16 GPIO, and you can add 8 of them connected to only D0 and D1 if you need 128 additional GPIO.

The GPIO expanders are also handy if you need an actual 5V output. The Photon and Electron only ever generate 3.3V on a digital output, but the expander can be used as true 5 volt GPIO, both input and output.

4 Likes

Actually there are only D0~D7 no D8 :wink:

1 Like