Long press simulation to device

Hi,

I'm using an external device (mp3 player ...) that has buttons
These buttons are active at low
They have 2 modes : short press + long press (> 2 seconds)

I'm trying to simulate button press with arduino.

No problem for short press, with 'digitalwrite(pin, LOW) during 20 ms before digitalwrite(pin, HIGH)
But, long press doesn't work, whatever is the duration ...

Any idea or suggestion ?

thanks in advance

PS : i looked the forum, but "long press" or "button" seems to be for arduino input, not output to external device.

Not sure what you're trying to do...

You want an Arduino output to be normally high, then go low for some time (short time <2s, long time >2s) and then revert to high?

What would cause the go low, and how would it know to stay low for the short or long time?

Any idea or suggestion ?

Please follow the advice on posting a programming question given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here

Kind of hard to help without seeing your code.

Check out: https://arduinogetstarted.com/tutorials/arduino-button-long-press-short-press

No problem for short press, with 'digitalwrite(pin, LOW) during 20 ms before digitalwrite(pin, HIGH)
But, long press doesn't work, whatever is the duration ...

Are you saying that the following is received by the player as a short press

digitalWrite(pin,LOW);
delay(20);
digitalWrite(pin,HIGH);

But this is not seen as a long press.

digitalWrite(pin,LOW);
delay(2000);
digitalWrite(pin,HIGH);

cattledog:
Are you saying that the following is received by the player as a short press

digitalWrite(pin,LOW);

delay(20);
digitalWrite(pin,HIGH);




But this is not seen as a long press.



digitalWrite(pin,LOW);
delay(2000);
digitalWrite(pin,HIGH);

That was my take on it, which would point to a problem at the receiving end.

Perhaps OP, if you posted your code someone might spot a problem though, who knows.

@vilmabergmann,

That's thé exact code... But not working for 'long' press.

When direct l'y applying à wire (low level) by hand for +2 seconds, it works as expected.

Need à capacitor ?

Thanks for help

Post your sketch and a circuit diagram.