Hello,
I’m using an Arduino Mega to control several outputs. For easy circuit trace routing, I decided to use pins 20 & 21 for outputs 15 & 16 which also happen to be the SDA & SCL pins.
I set each pin low before initializing them to prevent false triggers upon startup. However, I’m finding that the SDA & SCL pins consistently fire together at startup before resetting soon after.
How can I handle initializing these pins differently as to avoid the false triggers upon startup?
Thanks!
//This array contains the pin numbers that corresponds to the output.
const int output[numOfOutputs] = {12,11,10,9,8,7,6,5,14,15,16,17,18,19,20,21,36,34,32,30,28,26,24,22,38,40,42,44,46,48,50,52};
void setup() {
//---------------PIN MODES---------------
for (int pin = 0; pin < numOfOutputs; pin++){
digitalWrite(output[pin], LOW);
pinMode(output[pin], OUTPUT);}
}

