digitalWrite to analog pin?

Does this work on the Photon?

pinMode (A3, OUTPUT) ;
digitalWrite (A3, HIGH) ;

(Because I’m out of digital pins).

1 Like

Yes

4 Likes

If only there were a thing like documentation…
https://docs.particle.io/reference/firmware/photon/#digitalwrite-

2 Likes

If only there was a way to find it in the documentation. All that link says for digitalWrite is

“Write a HIGH or a LOW value to a digital pin.”

but that does not actually answer the question.

The “note” at the end of that section

Note: All GPIO pins (A0…A7, D0…D7, DAC, WKP, RX, TX) can be used as long they are not used otherwise (e.g. as Serial1 RX/TX).

looks like its saying A3 cannot be used, unless you get out the magnifying glass and notice that between A0 and A7 are two tiny dots, which presumably means “A0 through A7”. But I didn’t see that. :frowning:

So thanks very much to nrobinson2000 for a clear and succinct answer.

3 Likes

Good point! Let’s have a poll on how to fix it :slight_smile:

  • A0 … A7, D0 … D7
  • A0 ~ A7, D0 ~ D7
  • A0 - A7, D0 - D7
  • A0 through A7, D0 through D7
  • A0, A1, A2, A3, A4, A5, A6, A7, D0, D1, D2, D3, D4, D5, D6, D7

0 voters

1 Like

But the same ellipsis dots (commonly used for omissions of non-essential/obvious parts) are found between D0 and D7, but with these there didn’t exist any confusion whether or not the pins in-between were included or not?


BTW, punctuation (which mostly only features single instances of these “tiny” symbols) does have a meaning in written text too. Sometimes the presence or absence of one single punctuation symbol creates a completely different meaning. Size doesn’t always matter :wink:

1 Like

Well that assumes one even gets past

Right at the top of that section. Not “digital or analog”, just digital. That seems pretty clear to me. No point even reading any further than that. So maybe the documentation should be changed, for the benefit of idiots like me.

1 Like

The documentation is open-source, so by all means, feel free to make pull requests with improvements to the benefit of us all.
In all fairness though, I think it’s not unreasonable to expect one to at least read the entire section when attempting to make something, and if not then, then before asking others, but that’s just me.

1 Like

I changed digital pin for GPIO pin to remove any doubt :wink:

1 Like