Pins goes low during reset and mode change

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?

I think you can use a mosfet. the gate if driven stores some charge like capacitor and remain open until this charge dissipate. for closing the mosfet his gate must be grounded (N-canal), but while reset is arduino pin in Z-state.

The problem is that the pin does not remain in Z-state. It goes low some time during the reset, power on and mode change.

As stated in the first post, the pull up should prevent it from floating which means that the pin must at some point be low in order for the flip flop to activate.

no one output pin stay remain at reset.
you must overthink your idea.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.