Sony remote with long press button

Hey Arduino Gurus,

I have a Sony remote that has a long press button for “MENU” as seen in the attached pic. I have no problem executing the following code to activate the short press function (which is “SOUND”):

#include <IRremote.h>

IRsend irsend;

void setup()
{
  Serial.begin(9600);
}

void loop() {
  if (Serial.read() != -1) {
    for (int i = 0; i < 3; i++) {
      irsend.sendSony(0x421, 15); // Sony Source button
      delay(40);
    }
  }
}

I can’t seem to find the right code for the long press function. Any thoughts? Here is the raw dump from the standard IRrecvDump sketch when long pressing the “SOUND” button on the Sony remote:

421
Decoded SONY: 421 (15 bits)
Raw (32): -27664 2400 -550 650 -550 650 -550 600 -550 650 -550 1250 -550 650 -500 650 -550 650 -550 650 -550 1200 -550 650 -550 650 -550 650 -500 650 -550 1250
FFFFFFFF
FFFFFFFF (0 bits)
Raw (32): -22350 2450 -550 650 -500 650 -550 650 -550 650 -550 1200 -550 650 -550 650 -550 650 -500 650 -550 1250 -550 650 -550 600 -550 650 -550 650 -550 1200
FFFFFFFF
FFFFFFFF (0 bits)
Raw (32): -22400 2400 -550 650 -550 600 -550 650 -550 650 -550 1250 -500 650 -550 650 -550 650 -550 600 -550 1250 -550 650 -550 650 -500 650 -550 650 -550 1250
FFFFFFFF
FFFFFFFF (0 bits)
Raw (32): -22400 2450 -500 650 -550 650 -550 650 -550 600 -550 1250 -550 650 -550 650 -500 650 -550 650 -550 1250 -500 650 -550 650 -550 650 -550 650 -500 1250
FFFFFFFF
FFFFFFFF (0 bits)
Raw (32): -22350 2450 -550 600 -550 650 -550 650 -550 650 -550 1200 -550 650 -550 650 -550 600 -550 650 -550 1250 -550 600 -550 650 -550 650 -550 650 -550 1200
FFFFFFFF
FFFFFFFF (0 bits)
Raw (32): -22400 2400 -550 650 -550 650 -550 600 -550 650 -550 1250 -550 650 -500 650 -550 650 -550 650 -550 1200 -550 650 -550 650 -550 650 -500 650 -550 1250

I imported all of your codes into AnalysIR and they all decode to the same signal (Sony 0x421 - 15 bits).

So it looks like the long press function is implemented by the Sony device (TV?).

Normally, a single press of a Sony key, sends 3 repeated signals…so you may need to up the number in your loop

So try the following:

    for (int i = 0; i < 13; i++) {
      irsend.sendSony(0x421, 15); // Sony Source button
      delay(40);
    }

If that doesn’t work, then alter the 13 up/down and also consider changing the delay from 40 to 22 ms(or 20ms, 21ms, 23ms etc).