Remote control trouble

I have a question about infrared remote control, I was adding to my project a remote control, I reach to decode every button I've found In it but it doesn't work properly.

I only want to change relays status from High to Low with two buttons.

When I try it I've push the buttons but nothing happens.

Here you can see the code below. What should I change in it?



Posting pictures of code is discouraged. Please consider editing your post and posting the code in code tags.

1 Like

That is not your complete sketch. To fix this, using your IDE:

  1. open the sketch
  2. CTRL-A to "select all" of your sketch
  3. open a forum reply to your responses
  4. click the < CODE > icon in the edit window
  5. paste your code where the edit window say, "... '''type or paste your code here'''

Your code should look something like this...

void setup() {
  // YOU ARE MISSING CONFIGURING THE IRREMOTE DEVICES IN SETUP
}

void loop() {
  digitalWrite (2, LOW);
  digitalWrite (3, LOW);
  if (irrecv.decode(&results))
  {
    on = !on;
    digitalWrite (13, on ? HIGH LOW);
    irrecv.resume ();
    Serial.println("RECIBIENDO");
    Serial.print (results.value);
    Serial.print (F("-> "));
    switch (results.value) {
      case 0xFFA25D:
        Serial.println (F("POWER")); break;
        digitalWrite (2, HIGH);
        digitalWrite(3, HIGH); // <-- WHERE IS THE 'break;'??
      case 0xFF629D:
        Serial.println (F("VOL+")); break;
      case 0xFFE21D:
        Serial.println (F("FUNC/STOP")); break;
      case 0xFF22DD:
        Serial.println (F("FAST BACK")); break;
      case 0xFF02FD:
        Serial.println (F("PLAY/PAUSE")); break;
      case 0xFFC23D:
        Serial.println (F("FAST FORWARD")); break;
      case 0xFF38
          Serial.println (F("5")); break;
      case 0xFF5AA5:
        Serial.println(F("6")); break;
      case 0xFF42BD:
        Serial.println (F("7")); break;
      case 0xFF4AB5:
        Serial.println (F("8")); break;
      case 0xFF52AD:
        Serial.println (F("9")); break;
        irrecv.resume ();
    }
    delay(300);
  }
}
1 Like

This looks very similar to his previous question posted the same way.

: (

Maybe this time...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.