if(results.value == 2800){ //if you want to configure with your remote controll change the results.value digitalWrite(motor1, HIGH); // set the LED on digitalWrite(motor2, LOW); if (irrecv.decode(&results)) { Serial.println(results.value, DEC); if(results.value == 2672) digitalWrite(motor1, LOW); // set the LED off digitalWrite(motor2, LOW);

irrecv.resume(); // Receive the next value } if(results.value == 752) digitalWrite(motor1, HIGH); // set the LED on digitalWrite(motor2, LOW); if(results.value == 2672) digitalWrite(motor1, LOW); // set the LED off digitalWrite(motor2, LOW);

First create a sketch that just runs the motor back and forth. Get that working before going to the next step

Then create another sketch that reports the IR status on the Serial Monitor window. Get that working.

Now you can combine the two.

Without getting into the sketch itself, your problem could be just about anything, so you need to take things one step at a time, and verify that the parts of your scheme work as expected. Maybe you're not using the right type of IR remote for the codes you're looking for. Who knows.