analogRead(B5)?

I’d like to connect an analog sensor to port B5 to my electron.

In the datasheet, this seems possible:

B0 and B1 are digital only while B2, B3, B4, B5 are 12-bit A/D inputs as well as digital GPIOs. B0, B1, B2, B3 can also be used as PWM1 outputs.

In the reference documentation, this seems impossible:

analogRead() takes one argument pin: the number of the analog input pin to read from (‘A0 to A7’.).

Does anyone have experience with this?

Hi @hwestbrook

Did you mean “D5” or “B5”? These are totally different pins and “D5” is not an analog input, while “B5” is.

I meant B5, that is my mistake. I will update

@bko,

So B5 will work as analog with the analogRead(B5) function? Does this mean the documentation for firmware is currently incorrect?

Hi @hwestbrook

I just checked the doc and it looks correct for Electron (and Photon). When you on the doc page you have to select which platform you are using in the upper right hand corner–there is a pull-down for Photon, Electron, etc. Be sure you are on Electron.

Yes, analogRead(B5) should work.

2 Likes