IR receiver strange behavior

Or at least that is what I think.

I just bought the Vs1838b IR receiver. I tried with three differente remote controls: a Samsung TV, an old Technics CD player and a cable TV controller.

The Samsung is correctly read, but with the other two ones this is what happens: if I press and quickly release the button, the correct code is shown, but if I keep it pressed, it will then show (results converted to int)

4294967295 as long as I keep the button pressed.

The receiver runs at 38 KHz. Is there something with those two controls, maybe they run at a different freq?

Thanks

4,294,967,295.is 0xFFFFFFFF in decima!. 0xFFFFFFFF is the NEC repeat code. So the button code is sent once and the repeat code is then sent as long as the button is held.

Is there any list of compatible remote contols?

The Samsung I have works ok, now, will any Samsung remote controller behave the same? Regardless of the codes, will any Samsung behave as a NEC (with that repeat code)?

I can make the sketch compatible with any remote control by keeping track of the last button that was pressed and repeating its value if the repeat code is detected. Otherwise (non NEC compatible controls) it will just repeat the code for the pressed button.

Thanks.

You probably will have to burn the midnight oil to confirm the characteristics of your remotes.

I have some Samsung remotes that follow the NEC protocol.

The code is sent then the repeat code follows over and over as long as that button is held down.

.

Well I did some homework and played with the SAMSUNG TV and an old TECHNICS CD player remote controls, this one I will use to control my model trains.

If there is a repeat code, I just repeat the previous button.

//////////////////////////////////////////////////////////////////////////////////////
#include <IRremote.h>

int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);

const long REPEAT_CODE = 4294967295;
long previousCode = 0;

/* SAMSUMG */
const long SAMSUNG_1 = 3772784863;
const long SAMSUNG_2 = 3772817503;
const long SAMSUNG_3 = 3772801183;
const long SAMSUNG_4 = 3772780783;
const long SAMSUNG_5 = 3772813423;
const long SAMSUNG_6 = 3772797103;
const long SAMSUNG_7 = 3772788943;
const long SAMSUNG_8 = 3772821583;
const long SAMSUNG_9 = 3772805263;
const long SAMSUNG_0 = 3772811383;
const long SAMSUNG_VOL_INC = 3772833823;
const long SAMSUNG_VOL_DEC = 3772829743;
const long SAMSUNG_CHNL_INC = 3772795063;
const long SAMSUNG_CHNL_DEC = 3772778743;

/* TECHNICS */
const long TECHNICS_POWER = 845411;
const long TECHNICS_0 =865881;
const long TECHNICS_1 =792189;
const long TECHNICS_2 =857693;
const long TECHNICS_3 =824941;
const long TECHNICS_4 =890445;
const long TECHNICS_5 =808565;
const long TECHNICS_6 =874069;
const long TECHNICS_7 =841317;
const long TECHNICS_8 =906821;
const long TECHNICS_9 =800377;
const long TECHNICS_10 =794236;
const long TECHNICS_GREATER_THAN_10 = 851552;
const long TECHNICS_PROGRAM = 882257;
const long TECHNICS_CLEAR = 894539;
const long TECHNICS_RECALL = 861787;
const long TECHNICS_AB_REPEAT = 796283;
const long TECHNICS_REPEAT = 902727;
const long TECHNICS_RANDOM = 915009;
const long TECHNICS_TIME_MODE = 863834;
const long TECHNICS_LEVEL_DN = 872022;
const long TECHNICS_LEVEL_UP = 806518;
const long TECHNICS_AUTO_CUE = 888398;
const long TECHNICS_SEARCH_L = 804471;
const long TECHNICS_SEARCH_R = 869975;
const long TECHNICS_SKIP_L = 820847;
const long TECHNICS_SKIP_R = 886351;
const long TECHNICS_STOP = 788095;
const long TECHNICS_PAUSE = 837223;
const long TECHNICS_PLAY = 829035;

decode_results results;

void setup()
{
Serial.begin(115200);
irrecv.enableIRIn(); // Start the receiver
}

void loop() {

if (irrecv.decode(&results)) {
//Serial.println(results.value, DEC);
int boton = int(results.value);
delay(200);
if (boton==REPEAT_CODE)
{
boton=previousCode;
}
else
{
previousCode=boton;
}
switch (boton)
{
case SAMSUNG_1:
Serial.println(“SAMSUNG 1”);
break;
case SAMSUNG_2:
Serial.println(“SAMSUNG 2”);
break;
case SAMSUNG_3:
Serial.println(“SAMSUNG 3”);
break;
case SAMSUNG_4:
Serial.println(“SAMSUNG 4”);
break;
case SAMSUNG_5:
Serial.println(“SAMSUNG 5”);
break;
case SAMSUNG_6:
Serial.println(“SAMSUNG 6”);
break;
case SAMSUNG_7:
Serial.println(“SAMSUNG 7”);
break;
case SAMSUNG_8:
Serial.println(“SAMSUNG 8”);
break;
case SAMSUNG_9:
Serial.println(“SAMSUNG 0”);
break;
case SAMSUNG_VOL_INC:
Serial.println(“SAMSUNG VOL INC”);
break;
case SAMSUNG_VOL_DEC:
Serial.println(“SAMSUNG VOL DEC”);
break;
case SAMSUNG_CHNL_INC:
Serial.println(“SAMSUNG CHNL INC”);
break;
case SAMSUNG_CHNL_DEC:
Serial.println(“SAMSUNG CHNL DEC”);
break;
case TECHNICS_0:
Serial.println(“TECHNICS 0”);
break;
case TECHNICS_1:
Serial.println(“TECHNICS 1”);
break;
case TECHNICS_2:
Serial.println(“TECHNICS 2”);
break;
case TECHNICS_3:
Serial.println(“TECHNICS 3”);
break;
case TECHNICS_4:
Serial.println(“TECHNICS 4”);
break;
case TECHNICS_5:
Serial.println(“TECHNICS 5”);
break;
case TECHNICS_6:
Serial.println(“TECHNICS 6”);
break;
case TECHNICS_7:
Serial.println(“TECHNICS 7”);
break;
case TECHNICS_8:
Serial.println(“TECHNICS 8”);
break;
case TECHNICS_9:
Serial.println(“TECHNICS 9”);
break;
case TECHNICS_10:
Serial.println(“TECHNICS 10”);
break;
case TECHNICS_PROGRAM:
Serial.println(“TECHNICS PROGRAM”);
break;
case TECHNICS_CLEAR:
Serial.println(“TECHNICS CLEAR”);
break;
case TECHNICS_RECALL:
Serial.println(“TECHNICS RECALL”);
break;
case TECHNICS_AB_REPEAT:
Serial.println(“TECHNICS AB REPEAT”);
break;
case TECHNICS_REPEAT:
Serial.println(“TECHNICS REPEAT”);
break;
case TECHNICS_RANDOM:
Serial.println(“TECHNICS RANDOM”);
break;
case TECHNICS_TIME_MODE:
Serial.println(“TECHNICS TIME MODE”);
break;
case TECHNICS_LEVEL_DN:
Serial.println(“TECHNICS LEVEL DN”);
break;
case TECHNICS_LEVEL_UP:
Serial.println(“TECHNICS LEVEL UP”);
break;
case TECHNICS_AUTO_CUE:
Serial.println(“TECHNICS AUTO CUE”);
break;
case TECHNICS_SEARCH_L:
Serial.println(“TECHNICS SEARCH L”);
break;
case TECHNICS_SEARCH_R:
Serial.println(“TECHNICS SEARCH R”);
break;
case TECHNICS_SKIP_L:
Serial.println(“TECHNICS SKIP L”);
break;
case TECHNICS_SKIP_R:
Serial.println(“TECHNICS SKIP R”);
break;
case TECHNICS_STOP:
Serial.println(“TECHNICS STOP”);
break;
case TECHNICS_PAUSE:
Serial.println(“TECHNICS PAUSE”);
break;
case TECHNICS_PLAY:
Serial.println(“TECHNICS PLAY”);
break;
case TECHNICS_POWER:
Serial.println(“TECHNICS POWER”);
break;
case TECHNICS_GREATER_THAN_10:
Serial.println(“TECHNICS GREATER THAN 10”);
break;
default:
Serial.println(results.value, DEC);
}
irrecv.resume(); // Receive the next value
}
}
//////////////////////////////////////////////////////////////////////////////////////