loop() method loops too fast to process IRsignal?

Hello I am trying to build an addressable LED strip and be controlled by small IR remote.
there are some lighting presets(not a solid color, but looping colors) I coded, but my arduino is having hard time detecting IR message one it is up and running. I have testes all the connection, but I am confident that it is a coding problem, not hardware.

/*
Lastest version developed on 12/09/2016
*/
#include <PololuLedStrip.h>
#include <LiquidCrystal.h>
#include "IRremote.h"

#define LED_COUNT 208

int receiver = 8;
int preset = 10;

PololuLedStrip<7> ledStrip;

LiquidCrystal lcd(6, 5, 4, 3, 2, 1);
rgb_color colors[LED_COUNT];

IRrecv irrecv(receiver);
decode_results results;

void setup() {

//Serial.begin(9600);
//Serial.println("serial begin");

lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("Hello Jiwoo! =)");
lcd.setCursor(0, 1);
lcd.print("Choose LED Mode");

//traceInitialize();
//traceBlackout();

irrecv.enableIRIn();
}

void loop() {

delay(180);

if (irrecv.decode(&results)) {
translateIR();
irrecv.resume();
}

lcd.setCursor(0, 1);

switch (preset){
case 0:
blackout();
lcd.print("0. Blackout ");
break;

case 1:
police();
lcd.print("1. Police Chase ");
break;

case 2:
rainbow();
lcd.print("2. Rainbow ");
break;

case 3:
desolve();
lcd.print("3. Desolve ");
break;

case 4:
white();
lcd.print("4. White ");
break;

case 5:
red();
lcd.print("5. Red ");
break;

case 6:
green();
lcd.print("6. Green ");
break;

case 7:
blue();
lcd.print("7. Blue ");
break;

case 8:
violet();
lcd.print("8. Violet ");
break;

case 9:
pink();
lcd.print("9. Pink ");
break;

default:
lcd.print("Choose LED Mode! ");
blackout();
}
}

void traceInitialize() {
for (uint16_t i = 0; i <= 105; i++) {
colors = (rgb_color) {

  • 127, 127, 127*
  • };*
  • colors[i + 105] = (rgb_color) {*
  • 127, 127, 127*
  • };*
  • ledStrip.write(colors, LED_COUNT);*
    }
    for (uint16_t i = 0; i <= 105; i++) {
    colors = (rgb_color) {
    * 50, 50, 214*
    * };*
    * colors[i + 105] = (rgb_color) {
    _
    50, 50, 255*_
    * };*
    * ledStrip.write(colors, LED_COUNT);
    _
    }_
    for (uint16_t i = 0; i <= 105; i++) {
    colors = (rgb_color) {
    _ 218, 112, 214*
    * };_
    colors[i + 105] = (rgb_color) {
    _ 218, 112, 214*
    * };_
    ledStrip.write(colors, LED_COUNT);
    _}
    for (uint16_t i = 0; i <= 105; i++) {
    colors = (rgb_color) {
    50, 127, 0*

    * };_
    colors[i + 105] = (rgb_color) {
    _ 50, 127, 0*
    * };_
    ledStrip.write(colors, LED_COUNT);
    _}
    for (uint16_t i = 0; i <= 105; i++) {
    colors = (rgb_color) {
    250, 0, 0*

    * };_
    colors[i + 105] = (rgb_color) {
    _ 127, 80, 40*
    * };_
    ledStrip.write(colors, LED_COUNT);
    _}
    }
    void traceBlackout() {_

    for (uint16_t i = 0; i < LED_COUNT; i++) {
    colors = (rgb_color) {0,0,0};
    ledStrip.write(colors, LED_COUNT);
    _}
    }
    void blackout() {
    for (uint16_t i = 0; i < LED_COUNT; i++) {
    colors = (rgb_color) {0,0,0};
    }

    *ledStrip.write(colors, LED_COUNT); *
    }
    void white() {
    for (uint16_t i = 0; i < LED_COUNT; i++) {
    colors = (rgb_color) {120, 120, 120};
    }
    ledStrip.write(colors, LED_COUNT);
    }
    void police() {_

    for ( uint16_t i = 0; i <= 30; i++) {
    colors = (rgb_color) {
    _ 200, 0, 0*
    * };
    }_

    for ( uint16_t i = 31; i <= 72; i++) {
    colors = (rgb_color) {
    _ 127, 127, 127*
    * };
    }_

    for ( uint16_t i = 73; i <= 136; i++) {
    colors = (rgb_color) {
    _ 0, 0, 0*
    * };
    }_

    for ( uint16_t i = 137; i <= 174; i++) {
    colors = (rgb_color) {
    _ 127, 127, 127*
    * };
    }_

    for ( uint16_t i = 175; i < 208; i++) {
    colors = (rgb_color) {
    _ 200,0,0*
    * };
    }_

    ledStrip.write(colors, LED_COUNT);
    _ delay(100);_
    for ( uint16_t i = 0; i <= 30; i++) {
    colors = (rgb_color) {
    _ 0, 0, 0*
    * };
    }_

    for ( uint16_t i = 73; i <= 136; i++) {
    colors = (rgb_color) {
    _ 0, 0, 200*
    * };
    }*_

* for ( uint16_t i = 175; i < 208; i++) {
colors = (rgb_color) {
_ 0,0,0*
* };
}_

ledStrip.write(colors, LED_COUNT);
_ delay(100);
}
void rainbow()
{
uint16_t time = millis() >> 2;
for (uint16_t i = 0; i < LED_COUNT; i++)
{
byte x = (time >> 2) - (i << 3);
colors = hsvToRgb((uint32_t)x * 359 / 256, 255, 255);
}
ledStrip.write(colors, LED_COUNT);
}
void desolve()
{
uint16_t time = millis() >> 2;
for (uint16_t i = 0; i < LED_COUNT; i++)
{
byte x = (time >> 2);
colors = hsvToRgb((uint32_t)x * 359 / 256, 255, 255);
}
ledStrip.write(colors, LED_COUNT);
}
rgb_color hsvToRgb(uint16_t h, uint8_t s, uint8_t v)
{
uint8_t f = (h % 60) * 255 / 60;
uint8_t p = (255 - s) * (uint16_t)v / 255;
uint8_t q = (255 - f * (uint16_t)s / 255) * (uint16_t)v / 255;
uint8_t t = (255 - (255 - f) * (uint16_t)s / 255) * (uint16_t)v / 255;
uint8_t r = 0, g = 0, b = 0;
switch ((h / 60) % 6) {
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
case 3: r = p; g = q; b = v; break;
case 4: r = t; g = p; b = v; break;
case 5: r = v; g = p; b = q; break;
}
return (rgb_color) {
r, g, b*

};
}
int translateIR()
{
switch (results.value)
{
/***** ON/OFF /
case 0xFFA25D:
case 0x24AE7D4F:
case 0x74706571:
case 0xE318261B: lcd.print(" ON/OFF ");
break;*

/
* VOL+/

* case 0xFF629D:
case 0xE762B7C5:
case 0xC89738EC: lcd.print(" VOL+ "); break;*

/
STOP /
case 0xFFE21D: lcd.print(" STOP "); break;*
/
* LEFT /
case 0xFF22DD: lcd.print(" LEFT "); break;*
/
* OK /
case 0xFF02FD:
case 0xF735783D:
case 0xDAC8C9E2:
case 0xD7E84B1B:
case 0x5ADE6FA6:
case 0xDDE32E9D:
case 0xF660AE09:
case 0x99100584:
case 0xD98108A4:
case 0x169CBE62: lcd.print(" OK "); break;*
/
* RIGHT /
case 0x20FE4DBB: lcd.print(" RIGHT "); break;*
/
* DOWN /
case 0xFFE01F: lcd.print(" DOWN "); break;*
/
* VOL- /
case 0xA3C8EDDB: lcd.print(" VOL- "); break;*
/
* UP /
case 0xE5CFBD7F: lcd.print(" UP "); break;*
/
* 0 ****/
case 0x95863797:
case 0xA03B9AEC:
case 0xA26DDBE:
case 0x2FEEEE60:
case 0xCDC2DA90:
case 0x4165A410:
case 0x84BAFC76:
case 0x54CE234C:
case 0xE1E7B143:
case 0xD2C0D8C1:
case 0xC6DFE2FA:
case 0xE9C5DCF7:
case 0x5C7070EB:
case 0x1D1E5979:
case 0xC101E57B:
case 0x35F0124A:*_

* preset = 0;*
* //Serial.println(results.value);*

* break;*
_ /***** 1 ****/
case 0x9716BE3F:
case 0x29EB4B43:
case 0xFF30CF:
case 0xBB7F4C92:
case 0xDDE32E9C:
case 0xA80E7E5E:
preset = 1;*_

* break;*
_ /***** 2 ****/
case 0x3D9AE3F7:
case 0x55B0F71D:
case 0xFF18E7:
case 0x44D760DF:
case 0x16BF44A4:
preset = 2;*_

* break;*
_ /***** 3 ****/
case 0x6182021B:
case 0xFF7A85:
case 0x4CB0FADF:
case 0x49B0F624:
preset = 3;*_

* break;*
_ /***** 4 ****/
case 0x4CB0FADD:
case 0x5ED6908C:
case 0xFF10EF:
case 0x8C22657B:
case 0x85E8F527:
case 0x72BBD0C:
case 0x776F75B7:
preset = 4;*_

* break;*

* default:*
* Serial.println(results.value, HEX);*

}
}

Please read the post at the top of the Forum on how to post here, especially the use of code tags for source code listing. Also, use Ctrl-T in the IDE before posting the code. It reformats it in a common C style which makes it easier to read.

Finally, within loop() you have:

void loop() {

delay(180);                        // Do you really need this? (Hint: No.)

if (irrecv.decode(&results)) {
   translateIR();
    irrecv.resume();
}                                  // Move this to the bottom of loop()
// the rest of the loop code

If you are waiting for something to decode, it would seem that all of the code after the if statement block should be included in the block. It seems to me none of the statements after the block need to be executed unless the message has arrived.