i am using a l293d motor shield to drive 4 dc motors and 2 servos. And also using an hx1832 IR receiver to receive inputs
the problem is that after introducing the IRremote library into the code some dc motors no longer work
ive tested it out, upon removing the IRremote library all the motors start working again
this is the circut, the motors ive crossed out are the ones that dont work
this is the code. (note: right() , left(), and move_stop() are just functions to drive the dc motors, i didnt show them because it would make this code part too long)
#include <Servo.h>
#include <AFMotor.h>
#include <IRremote.hpp>
//#define IR_USE_AVR_TIMER 2
Servo gripper;
//0 is close 80 is open
//is servo 1
Servo arm;
//180 is up and 0 is down
//is servo 2
AF_DCMotor motor_Kanan_Depan(3);
AF_DCMotor motor_Kanan_Belakang(2);
AF_DCMotor motor_Kiri_Depan(1);
AF_DCMotor motor_Kiri_Belakang(4);
void setup() {
// put your setup code here, to run once:
gripper.attach(10);
arm.attach(9);
Serial.begin(9600);
Serial.println("start");
motor_Kanan_Depan.setSpeed(100);
motor_Kanan_Belakang.setSpeed(100);
motor_Kiri_Depan.setSpeed(100);
motor_Kiri_Belakang.setSpeed(150);
// IrReceiver.begin(2);
}
void loop() {
// if(IrReceiver.decode()){
// Serial.println(IrReceiver.decodedIRData.decodedRawData , HEX);
// IrReceiver.resume();
// }
gripper.write(0);
right();
delay(2000);
move_stop();
delay(1000);
left();
delay(2000);
move_stop();
delay(1000);
}
Wouldn't it be less effort to retire the v1 motor board that's been discontinued for more than a decade and use a v2 board that only uses the I2C pins and no timers at all?