Well I'm sorry I can't figure it out code was the same I added comments to post here and guess what.
I removed the led3 comment and got a error ' I back spaced all the way i guess there was a ' there somewhere and it didn't show till i added the comment. LOL
It's in the wrong loop lol dang this drove me nut's I read the whole pdf for IRLib2
At about the end I found it the dang thing works for maybe 5 minutes
Then quit's here the working code works great now
myReceiver.enableIRIn(); has to be (myReceiver.getResults()) { loop to keep it reading the remote or it stop's when
It feels like it
My dump truck code Fixed and working good. Thanks Whandall you was dead on it I moved it like 2 times but
wrong way lol.
What get's me is I started with code from Using an Infrared Library on Arduino they had it just like I did the code worked but i think it picks up noise and that shuts it down.
int enablePin = 5;
int in1Pin = 10;
int in2Pin = 11;
int enablePin1 = 6;
int in3Pin = 8;
int in4Pin = 9;
#include "IRLibDecodeBase.h"
#include "IRLibSendBase.h"
#include "IRLib_P01_NEC.h"
#include "IRLibCombo.h"
#include "IRLibRecv.h"
#include "IRLibRecvLoop.h"
#include "IRLibRecvPCI.h"
#include "IRLibFreq.h"
IRrecv myReceiver(2);//receiver on pin 2
IRdecode myDecoder;//Decoder object
void setup()
{
pinMode(in1Pin, OUTPUT);
pinMode(in2Pin, OUTPUT);
pinMode(in3Pin, OUTPUT);
pinMode(in4Pin, OUTPUT);
pinMode(enablePin, OUTPUT);
pinMode(enablePin1, OUTPUT);
myReceiver.enableIRIn(); // Start the receiver
}
void loop() {
if (myReceiver.getResults()) {
if(myDecoder.decode()){
if (myDecoder.protocolNum == NEC) {
switch (myDecoder.value) {
case 0xFF50AF: //up
digitalWrite(in3Pin, LOW);
digitalWrite(in4Pin, HIGH);
digitalWrite(enablePin1, HIGH);
break;
case 0xFF7887: //down
digitalWrite(in3Pin, HIGH);
digitalWrite(in4Pin, LOW);
digitalWrite(enablePin1, HIGH);
break;
case 0xFFA05F: //forward
digitalWrite(in1Pin,LOW);
digitalWrite(in2Pin, HIGH);
digitalWrite(enablePin,HIGH);
break;
case 0xFF40BF: //backward
digitalWrite(in1Pin,HIGH);
digitalWrite(in2Pin, LOW);
digitalWrite(enablePin,HIGH);
break;
case 0xFF02FD: //backward
digitalWrite(enablePin1, LOW);
digitalWrite(enablePin,LOW);
break;
}
}
}
myReceiver.enableIRIn(); //Restart the receiver
}
}