I'm using DeMos D1 R1.
the code is working great without a servo.attach(pinNumber), but with the ir is not printing.
this is the working code:
#include <Servo.h>
#include <IRremote.h>
Servo myCRServo;
const int PIN_RECV = 16;
void setup() {
Serial.begin(9600);
IrReceiver.begin(PIN_RECV);
//myCRServo.attach(5);
}
void loop() {
if (IrReceiver.decode()) {
IrReceiver.printIRResultShort(&Serial);
IrReceiver.resume();
}
}
and this is the code that not working:
#include <Servo.h>
#include <IRremote.h>
Servo myCRServo;
const int PIN_RECV = 16;
void setup() {
Serial.begin(9600);
IrReceiver.begin(PIN_RECV);
myCRServo.attach(5);
}
void loop() {
if (IrReceiver.decode()) {
IrReceiver.printIRResultShort(&Serial);
IrReceiver.resume();
}
}
note that the only thing I changed was the "myCRServo.attach(5);" line.
the problem is only accrued after the servo.attch() is called.
when i delay (with millis) the "servo.attach()" the Serial is printing the ir info until the servo.attach is called.
servo.detach is not help neither.
I can confirm that the ir is reciving data beacuse the led on the IRreceiver is lighting when i click on the remote.
Also, I haven't connected the servo to the 5 pin yet, does it relevant?
Thanks for the help!
7 posts - 4 participants