Hi i bought a new L293D Motor Shield and i got a problem with it. I can't seem to set my speed to 190 and if i do it it produce a beeping or buzzing sound it irritates my ears.. i tried following this tutorial on youtube but my design is different from him Arduino autonomous Robot Project: A DIY obstacle avoiding robot using an SG90 servo - YouTube. I got an rc car and on the youtube it has 2 motor also mine but on back and front. I look on to his code and the speed was set to 190 and also the motor khz is 1 i tried 64 and it does not seem to work. Also i was doing research and i found that the m3 m4 has 1 khz frequency while m1 m2 has 64 khz. Also tried that and got no luck. The beep will just gone if i set my speed to the max 255 but my goal is to slow it down a little bit.
Thank you.
Here is my Code.
#include <AFMotor.h>
AF_DCMotor backdrive(2, MOTOR12_64KHZ);
AF_DCMotor frontdrive(1, MOTOR12_64KHZ);
// initialize motor at 64 khz
void setup() {
backdrive.setSpeed(190);
frontdrive.setSpeed(190); // set speed to 190
delay(3000);
// end of setup
}
void go_forward()
{
backdrive.run(FORWARD);
}
void go_reverse()
{
backdrive.run(BACKWARD);
}
void stop_car()
{
backdrive.run(RELEASE);
frontdrive.run(RELEASE);
}
void go_left()
{
frontdrive.run(FORWARD);
}
void go_right()
{
frontdrive.run(BACKWARD);
}
// initialize all forward left right and reverse
void loop()
{
go_forward();
delay(500);
go_left();
delay(1000);
go_forward();
delay(1000);
go_right();
delay(500);
go_forward();
delay(1000);
stop_car();
delay(1000);
go_reverse();
delay(2000);
stop_car();
delay(500);
go_forward();
delay(500);
go_right();
delay(500);
go_forward();
delay(1000);
go_left();
delay(500);
go_forward();
delay(1000);
go_reverse();
delay(2000);
stop_car();
delay(3000);
// algorithm for my rc car and it does not have sensor.
// end of loop
}
Below is my wiring:
[
My motor is default and i don't know the model cause i just purchased it on the store. My wirings are just two motors connected at the motor shield. I also had an EXT_PWR and i didn't include it on my picture.