code for voice commands


i am trying to control a dc motor via my smartphone using voice commands. can anyone give me the coding to turn on/off a motor (connected to 12 and 13 on the arduino)?

also, what bluetooth app is best to use?

many thanks, james

There is a sticky post at the top of every forum that links to the How to use the forum page.

From that, item 4 4. Do some research before posting

Have you tried to find any code to turn on/off a motor? I bet it has been dome many times many different ways. Go look. Google is your friend.

Hint, I bet google might have something to say about how bluetooth has been used on the arduino.

Aside from not reading the “How to Use the Forum” page, you posted in the wrong place. This is not the “GIVE ME CODE FOR FREE” forum. This where you post the code that YOU write and members try to help you with problems (for free).

If you don’t want to do any work, but rather have someone provide you with code, go here. But, it likely won’t be for free.

thanks for nothing!

blueboy72: thanks for nothing!

What you get back depends on the effort that you put in. It worked out exactly in this case.

the code i used is:

#include <SoftwareSerial.h>

#include <SoftwareSerial.h>

SoftwareSerial BT(10, 11); //TX, RX respetively
String readvoice;

void setup() {
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(3, OUTPUT);
pinMode(7, OUTPUT);

void loop() {
while (BT.available()){ //Check if there is an available byte to read
delay(10); //Delay added to make thing stable
char c =; //Conduct a serial read
readvoice += c; //build the string- “forward”, “reverse”, “left” and “right”
if (readvoice.length() > 0) {

if(readvoice == “go”)
digitalWrite(13, HIGH);
digitalWrite (12, HIGH);

else if(readvoice == “back”)
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(3, HIGH);

i am using an arduino uno, hc-05 and l298n.

any advice?

What does your code do? What should it do that's different?