I am using a nano every and want a pin to remain high during reset, startup and setup. The test setup I have is to connect the pin to a jk flip flop connected in such a way that if the pin goes low the flip flop is set. The test pin in this case is the digital pin 2. I also put a pull up resistor on the pin to make it high when it normally would float.
This is the code i used to test if the pin ever goes low:
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
pinMode(2, INPUT_PULLUP);
digitalWrite(2, HIGH);
delay(2000);
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
digitalWrite(13, HIGH);
}
void loop() {
}
The on board LED is used to know when the pin is set to output and the expected result should be that the external LED never turns on.
When testing this with an arduino uno, the LED never turns on regardless if I remove the USB and reconnects it or press the reset button. But with the nano every the LED turns on both with power on and reset.
Now i realize that the flip flop could be defaulting to any state but I have also tried to resetting the flip flop during the delay and the LED still turn on when it is over. This would mean that at some point during startup, reset and setting the pin to output, the pin goes low enough to trigger the flip flop. Since the flip flop can be reset after the on board LED turns on, the pin is high after the program has finished.
Is my board damaged or is this something that the nano every does normally?