Hi,
So i have a problem with my arduino car. I have two motors connected to a MOSFET IRF520 on every axle and the problem is that they are not getting the voltage they sholud (they are getting about half of it) (and I'm checking it on the module) and for some weird reason if i connect one motor in works perfectly fine. Do You have any solution to this?
#include "HCMotor.h"
#define MOTOR_PIN1 7
#define MOTOR_PIN2 8
HCMotor HCMotor1;
HCMotor HCMotor2;
int Speed=0;
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
HCMotor1.Init();
HCMotor1.attach(1, DCMOTOR, MOTOR_PIN1);
HCMotor1.DutyCycle(1, 100);
HCMotor2.Init();
HCMotor2.attach(0, DCMOTOR, MOTOR_PIN2);
HCMotor2.DutyCycle(0, 100);
}
void loop()
{
delay(5000);
digitalWrite(LED_BUILTIN, HIGH);
for(Speed;Speed<100;Speed+=10)
{
HCMotor1.OnTime(1, Speed);
HCMotor2.OnTime(0, Speed);
delay(10);
}
delay(5000);
digitalWrite(LED_BUILTIN, LOW);
for(Speed;Speed>0;Speed-=10)
{
HCMotor1.OnTime(1, Speed);
HCMotor2.OnTime(0, Speed);
delay(10);
}
}