NOOB Question! need help with IRremote library

PaulS:
Consistent use of one base would be a good thing.

True it muddies the water using different bases but not the/a problem unless it casts to different data type.

:blush: I did not noticed you had commented out the "static byte lastValue;" its now replaced and corrected with proper data type "static unsigned long lastValue;". Without 'static' each time round the loop 'lastValue' was being reset to zero so you lost what the last non repeat key was. Ended up de-soldering the IR receiver from a defunct VHS recorder here at work to build a test setup :slight_smile:

#include <IRremote.h>

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
int led7 = 7;
int led8 = 8;

void setup()
{
    pinMode(led7, OUTPUT);
    pinMode(led8, OUTPUT);
    
    Serial.begin(9600);
    irrecv.enableIRIn(); // Start the receiver
    
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
    
}


void loop() {
    static unsigned long lastValue;
    if (irrecv.decode(&results)) {              // Check for IR button press
        unsigned long newValue = results.value; // Get IR code
        if (newValue == 0xffffffff) {           // NEC repeat button pressed?
            newValue = lastValue;               // Substitute last not repeat code
        }
        else {                                  // Not repeat code
            lastValue = newValue;               // Store last not repeat code
        }
        
        switch (newValue) {
        case 0x77E1D08B:
            //do something when var equals 1
            digitalWrite(led7, HIGH); 
            delay(50);
            break;
        case 0x77E1B08B:
            //do something when var equals 2
            digitalWrite(led8, HIGH); 
            delay(50);
            break;
        }
        digitalWrite(led7, LOW);
        digitalWrite(led8, LOW);
        irrecv.resume();                        // Receive the next value
    }
}