I'm trying for a school project to make a Bluetooth controlled small RC but the code I used didn't work in the end and now I don't know where to start. I have an hc-06 Bluetooth board and an L9110 motor driver but I don't know what code to even use to get the motor to move. I need 2 motors to work. 2 on the back to make it go straight and turn left and right. If anyone has a spare code that would work or a step I'm very new!
Start by posting the code you used. Then we can look to see why it "didn't work in the end" and maybe help to get it working.
But if you're driving 2 motors you're going to need more than one L9110. That's only a single motor driver IC and there is loads of basic code for it available from a simple search.
Steve
i used that file for it!
Bluetooth+car+by+Vishal+soni (1).zip (16.5 KB)
If you are not too far into your project, using two continuous rotation servos for the drive wheels would make powering and controlling your bot very easy.
see i would but im pretty set on this. i just need to make it mvoe atleast so i just need code to mvoe it forward aha
"see i would but im pretty set on this. i just need to make it mvoe atleast so i just need code to mvoe it forward aha"
You can do some reading below on previous similar projects.
god5580:
i used that file for it!
Please post the actual code as text using code tags as described in "How to use this forum - please read" at the top of the forum.
We're not keen on having to download and unpack zip files just to look at whatever you're having problems with.
Steve
#include <AFMotor.h>
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);
char bt='S';
void setup()
{
Serial.begin(9600);
motor1.setSpeed(255);
motor2.setSpeed(255);
motor3.setSpeed(255);
motor4.setSpeed(255);
Stop();
}
void loop() {
bt=Serial.read();
if(bt=='F')
{
forward();
}
if(bt=='B')
{
backward();
}
if(bt=='L')
{
left();
}
if(bt=='R')
{
right();
}
if(bt=='S')
{
Stop();
}
}
void forward()
{
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void backward()
{
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
}
void left()
{
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
}
void right()
{
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void Stop()
{
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
That AFMotor library is for an old Adafruit Motor Driver based on L293s not L9110s. Why did you decide that it would work with whatever motor driver you're using?
Please provide details of the actual motor driver board that you're using. Have you tried a simple test program just to make the motor move forward and back?
Steve
I have made it move yes with other programs. Thats the files i used and because i found those when i looked it up. Im using a L9110 2 way motor driver . Do you have anything i could use?