IR sensor stops receiving code

I can’t figure out why my sensor starts giving me random values after i run the switch case. CODE ATTACHED!

CODE ATTACHED!

NO IT WASN'T.

You can take your picture of text and shove it somewhere. Post your text AS TEXT!

Post ALL of your code.

Sorry about that! This is my first post. Heres the code. Thank you for your time!!!

// Include following libraries to access IR sensor
#include <IRremote.h>
#include <IRremoteInt.h>

int RECV_PIN = 12; // The digital pin that the signal pin of the sensor is connected to
IRrecv receiver(RECV_PIN); // Create a new receiver object that would decode signals to key codes
decode_results results; // A varuable that would be used by receiver to put the key code into

const int blu = 6;
const int grn = 3;
const int red = 5;
const int off = 0;
const int on = 255;

int r = 0;
int g = 0;
int b =255;

// Setup the pins connected to LEDs as output pin

void setup() {
Serial.begin(9600); // Setup serial port to send key codes to computer
receiver.enableIRIn(); // Enable receiver so that it would start processing infrared signals
pinMode(blu, OUTPUT);
pinMode(grn, OUTPUT);
pinMode(red, OUTPUT);

}

void loop() {
if(receiver.decode(&results)) { // Decode the button code and put it in “results” variable
Serial.println(results.value, HEX); // Print the code as a hexadecimal value
//receiver.resume();

switch (results.value) { // Key ‘1’ is pressed which belongs to the red LED

case 0xFF30CF: //INCREASE red led by 2
r = r + 2;
analogWrite(red, r);
analogWrite(grn, g);
analogWrite(blu, b);
break;
}
receiver.resume();

}
}

I can't figure out why my sensor starts giving me random values after i run the switch case.

I can't see what "random values" you are getting.

    Serial.println(results.value, HEX);       //  Print the code as a hexadecimal value

I hate anonymous printing. Some bunch of numbers and letters appear in the Serial Monitor application, with no indication of that they represent.

“I can’t see what “random values” you are getting.”

My random values are usually like this…

FF30CF
FF30CF
22AE7A29
FCC37F03
DBFFA29D

It works once or twice then gives random values, then just stops working altogether. The sensor will stop detecting any input.

So weird to me that it will only work a couple times. :confused: