I use a clone of the motor shield v1 from adafruit and have connected a ir-diode on its d2 pin.
I can sucessfully use the motorshield with a led connected to output 1 using this sketch
#include <AFMotor.h>
#include <IRLib.h>
AF_DCMotor motor(1, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
IRrecv My_Receiver(2); // d2
IRdecode My_Decoder;
void setup()
{
Serial.begin(9600);
// My_Receiver.enableIRIn();
}
void loop() {
motor.setSpeed(40);
motor.run(FORWARD);
delay(500);
}
But as soon as I comment in the line My_Receiver.enableIRIn(); the led is not lit anymore.
Also if I use this sketch to output the values from the ir-diode it is working, but a soon as I include the motorlibary and call motor.setSpeed(20) I cant see the values from the ir remote in the serial monitor anymore.
#include <IRLib.h>
#include <AFMotor.h>
IRrecv My_Receiver(2); // d2
IRdecode My_Decoder;
AF_DCMotor motor(1, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
void setup()
{
Serial.begin(9600);
My_Receiver.enableIRIn();
}
void loop() {
if (My_Receiver.GetResults(&My_Decoder)) {
My_Decoder.decode(); //Decode the data
Serial.println(My_Decoder.value, HEX);
//motor.setSpeed(20);
My_Receiver.resume(); //Restart the receiver
}
}
Is this a known isue? Any ideas to debug this further?