Loop until new command received

hi guys so i want to make each of the command from each hex code is looping until new hex code is received

any solutions ??

sorry if i dont post my code directly its so long and sorry if its messy, im new :slight_smile:

sketch_MultipleLEDmodeir1.ino (10.9 KB)

ADFFLAME:
hi guys so i want to make each of the command from each hex code is looping until new hex code is received

any solutions ??

sorry if i dont post my code directly its so long and sorry if its messy, im new :slight_smile:

not sure this will work but in "void loop()", try taking the "switch (results.value) " case out of the "if (irrecv.decode(&results))" statement.

ie

unsigned long results_value = 0;
void loop() {

  analogWrite(redpin, brightness_1);
  analogWrite(yellowpin, brightness_2);
  analogWrite(greenpin, brightness_3);
  analogWrite(whitepin, brightness_4);

  if (irrecv.decode(&results)) {
    results_value = results.value;
    irrecv.resume();
  }

  switch (results_value) {
      //the rest of your switch statement here
  }
}

Hopefully that does the trick! :wink:

the code was valid but unfortunately the lamp doesnt want to turn on