The behavior of the pins seems different whether I write the code as:
pinMode(freshwater_high_float_switch, INPUT);
pinMode(freshwater_fill_float_switch, INPUT);
digitalWrite(freshwater_high_float_switch, HIGH);
digitalWrite(freshwater_fill_float_switch, HIGH);
or as this:
digitalWrite(freshwater_high_float_switch, HIGH);
digitalWrite(freshwater_fill_float_switch, HIGH);
pinMode(freshwater_high_float_switch, INPUT);
pinMode(freshwater_fill_float_switch, INPUT);
When I print the results of digitalRead on these two pins using:
Serial.print("fill float switch is ");
Serial.println(digitalRead(freshwater_fill_float_switch));
Serial.print("high float switch is ");
Serial.println(digitalRead(freshwater_high_float_switch));
delay(500);
the first way above works correctly and the pins will read logic 1 until I ground them and then they will read logic 0. The second way above will read logic 1 for a few iterations and then one of the pins will start reading a logic 0 and then both pins will read a logic 0 a few iterations later. What is going on here?