i used this library and the example with controlling 2 motor to independently control each of the 6 motors i connected with IR remote. but for each motor i have to choose controller.TLE_PWM3, controller.TLE_PWM2, or controller.TLE_PWM1. and even if i use different buttons from remote for each motor, if i used controller.TLE_PWM3 for three motors for example, when i try to change the speed of one of them, all the 3 the motors are changing their speed. i attached here the code im trying to use.
im sorry if this is not a correct request, its my first day on this site and one of my first arduino projects.
thank you!
`
#include <TLE94112.h>
#include <Tle94112Motor.h>
#include <IRremote.h>
//declaram fiecare buton folosit. de ex n21 reprezinta butonul de la care comandam alimentarea motorului 2 cu factorul de umplere 1 (50%).
#define n11 0x1
#define n21 0x2
#define n31 0x3
#define n41 0x4
#define n51 0x5
#define n61 0x6
#define n12 0x7
#define n22 0x8
#define n32 0x9
#define n42 0x22
#define n52 0x0
#define n62 0xA
#define n13 0x29
#define n23 0x2C
#define n33 0x2D
#define n43 0x2B
#define n53 0x2F
#define n63 0x2E
#define ON 0xC
#define OFF 0xD
#define sus 0x20
#define jos 0x21
//setam pinul de intrare pentru receptorul IR
int RECV_PIN = 2;
Tle94112 controller = Tle94112();
Tle94112Motor motor1(controller);
Tle94112Motor motor2(controller);
Tle94112Motor motor3(controller);
Tle94112Motor motor4(controller);
Tle94112Motor motor5(controller);
Tle94112Motor motor6(controller);
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
irrecv.enableIRIn();
controller.begin();
// Configuram semipuntile la care conectam motorul 1
//dam sensul rotatiei, poate fi schimbat prin inversarea lowside cu hiside
motor1.connect(motor1.HIGHSIDE, controller.TLE_HB1);
motor1.connect(motor1.LOWSIDE, controller.TLE_HB3);
motor1.setPwm(motor1.HIGHSIDE, controller.TLE_PWM3);
// setam frecventa pwm la 200(poate fi setata si la 100 sau 80)
motor1.setPwmFreq(motor1.HIGHSIDE, controller.TLE_FREQ200HZ);
motor2.connect(motor2.HIGHSIDE, controller.TLE_HB2);
motor2.connect(motor2.LOWSIDE, controller.TLE_HB4);
motor2.setPwm(motor2.HIGHSIDE, controller.TLE_PWM3);
motor2.setPwmFreq(motor2.HIGHSIDE, controller.TLE_FREQ200HZ);
motor3.connect(motor3.HIGHSIDE, controller.TLE_HB5);
motor3.connect(motor3.LOWSIDE, controller.TLE_HB6);
motor3.setPwm(motor3.HIGHSIDE, controller.TLE_PWM3);
motor3.setPwmFreq(motor3.HIGHSIDE, controller.TLE_FREQ200HZ);
motor4.connect(motor4.HIGHSIDE, controller.TLE_HB7);
motor4.connect(motor4.LOWSIDE, controller.TLE_HB8);
motor4.setPwm(motor4.HIGHSIDE, controller.TLE_PWM1);
motor4.setPwmFreq(motor4.HIGHSIDE, controller.TLE_FREQ200HZ);
motor5.connect(motor5.HIGHSIDE, controller.TLE_HB11);
motor5.connect(motor5.LOWSIDE, controller.TLE_HB12);
motor5.setPwm(motor5.HIGHSIDE, controller.TLE_PWM1);
motor5.setPwmFreq(motor5.HIGHSIDE, controller.TLE_FREQ200HZ);
motor6.connect(motor6.HIGHSIDE, controller.TLE_HB10);
motor6.connect(motor6.LOWSIDE, controller.TLE_HB9);
motor6.setPwm(motor6.HIGHSIDE, controller.TLE_PWM1);
motor6.setPwmFreq(motor6.HIGHSIDE, controller.TLE_FREQ200HZ);
motor1.begin();
motor2.begin();
motor3.begin();
motor4.begin();
motor5.begin();
motor6.begin();
}
void loop()
{
//citirea codurilor de la telecomanda
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume();
//functionarea motoarelor
if (results.value == n11)
{
motor1.start(63);}
if (results.value == n12)
{
motor1.start(255);}
if (results.value == n13)
{
motor1.start(0);
}
if (results.value == n21)
{
motor2.start(63);
}
if (results.value == n22)
{
motor2.start(255);
}
if (results.value == n23)
{
motor2.start(0);
}
if (results.value == n31)
{
motor3.start(63);
}
if (results.value == n32)
{
motor3.start(255);
}
if (results.value == n33)
{
motor3.start(0);
}
if (results.value == n41)
{
motor4.start(63);
}
if (results.value == n42)
{
motor4.start(255);
}
if (results.value == n43)
{
motor4.start(0);
}
if (results.value == n51)
{
motor5.start(63);
}
if (results.value == n52)
{
motor5.start(255);
}
if (results.value == n53)
{
motor5.start(0);
}
if (results.value == n61)
{
motor6.start(63);
}
if (results.value == n62)
{
motor6.start(255);
}
if (results.value == n63)
{
motor6.start(0);
}
}
} `