BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

3 DC Motors,1 Servo, Arduino Uno, HM-10


#1

Hi,

I am trying to get 3 bi-directional DC motors to work along with a 180 degree servo. 2 of the DC motors will steer and drive the rc car I am building. These 2 are my main concern at the moment. I am using an HM-10 Bluetooth module and a L298N motor shield (although I suspect I will eventually have to switch to an Adafruit v2, but that’s neither here nor there) I have been able to connect to my bluetooth module for some time now and had it controlling my 180 degree servo before I introduced the motorshield into the equation (because servos can just be straight wired to the arduino and don’t require a motor shield.) Now that I am trying to get the motor shield involved I’m getting nowhere. Can someone pleeeeease help me by posting their code to get one dc motor working and controlled via a button on the blynk app. I know I have it wired correctly and I also know I have bluetooth and a servo good to go. But this rc car is useless if I can’t actually drive it! Here is my code that currently runs 2 servos (although I will be using 1 now.)

#define BLYNK_PRINT Serial
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
#include <Servo.h>
SoftwareSerial SwSerial(10, 11); // RX, TX

char auth[] = “d651b25ee9394d8fb295690a7317a317”;

Servo servo1;
Servo servo2;

BLYNK_WRITE(V5)
{
servo1.write(param.asInt());
}

BLYNK_WRITE(V6)
{
servo2.write(param.asInt());
}

SoftwareSerial SerialBLE(10, 11); // RX, TX

void setup()
{
// Debug console
Serial.begin(9600);

SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);

Serial.println(“Waiting for connections…”);

servo1.attach(5);
servo2.attach(6);
}

void loop()
{
Blynk.run();
}

//end code


#2

Hello,

Firstly, please format all posted code as per the instructions you deleted :wink: in order to post here… Please edit your initial post acordingly.

Also a good idea to block out part of your Auth code or someone else will be driving your servos :laughing:

Blynk - FTFC

Secondly, we help people learn about Blynk here, not hand out code on request :stuck_out_tongue_winking_eye:

That said, there is plenty of examples that others have already posted, I even have one… so I suggest you search this forum for keywords like Car, Rover, DC motor, etc.