I have a Longruner Nano ATMega 328P (copy of arduino nano, main difference being the USB connector, CH340 instead of the usual FT232, from what I could find using google searches).
I wrote a super basic code to test its signal detection capabilities:
setup(){
pinMode(13, OUTPUT);
pinMode(2, INPUT);
}
loop(){
digitalWrite(13, digitalRead(2));
}
Hard to make it simpler to test a simple thing: when I give a HIGH signal to D2, D13 is HIGH too.
To test it, I used a simple male-male jump cable and connected VIN pin to the D2 one, for a very brief moment. And I notice D13 stays HIGH for around a second (measured with serial, lowest I could get was 996ms after super quickly touching D2 with the jump cable).
I tried to change the pinMode to INPUT_PULLUP following a similar question I found, but it didn't change anything regarding this delay.
Am I doing something wrong? Maybe a wrong configuration? Or is this just a hardware issue due to the fact that I'm using a copy and there's more than just the USb connector that changes?
I can adapt and work with this if it's required, but being able to have an accurate signal detection would help me greatly.