How to digital I/O?

Used to low level coding at this end…Very typical to drive I/O low or high THEN set pin as output to avoid potential glitching.

Is this recommended for Argon?

Do Argon pins all default at boot to a low? or should I do a digitalWrite for each pin at setup?

1 Like

The pins do default to hi-Z (INPUT) mode on bootup. When setting pinMode to OUTPUT pins that weren’t otherwise (pre)set will default to LOW.

I have not tested this with the Argon, but with Gen2 devices you could pre-assign HIGH before setting pinMode() to OUTPUT via pinSetFast() or digitalWriteFast().

So basically I am hearing you say that with Gen2 devices you could NOT use digitalWrite prior to pinMode but rather had to use pinSet(Reset)Fast or digitalWriteFast…correct?

With Gen2 and Gen3 digitalWrite() will first check whether the pinMode() is set correctly in order to actually do anything.

In contrast to that the quoted low level functions (on both generations) will not perform any sanity check but expect the programmer to know what they are doing.
This foremost increases execution speed but also alows for “pre-setting” the level.

I mentioned Gen2 because that’s the platform I explicitly tested this an know that it works (or at least did back then). For Gen3 I have not had the need to test it so it would be up to you to confirm for yourself.

2 Likes