DIGITAL GPIO start-up glitch

I solved this very simply by using the fast io functions to set the desired initial value before configuring as an output and thus driving the output line.

   pinSetFast(pin); // initialize to HIGH
   pinSetMode(pin, OUTPUT);  // enable output

or

   pinResetFast(pin); // initialize to LOW
   pinSetMode(pin, OUTPUT);  // enable output

In reality, the library should have a setPinMode that takes a third argument which is the initial value. In my case I have some outputs that are active low and some that are active hi so I wrote a generic wrapper so I can change an output from active high to active low later and not worry about spreading HIGH and LOW around my code:

See my post here for details,

2 Likes