# Need help in code for my Arduino-bluetooh  car

**URL:** <https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654>\
**Category:** Robotics\
**Created:** [May 18, 2020, 2:32pm UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654 "2020-05-18T14:32:05Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![lepi11](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lepi11](https://forum.arduino.cc/u/lepi11)\
**Post date:** [May 18, 2020, 2:32pm UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/1 "2020-05-18T14:32:05Z")

</div>

Hello 🙂  
Can somebody help me to write a code for my bluetooth controlled car

I need a code for a servo which is used for steering. And for 2 motors on back wheels for going forward and backwards using app on my mobile phone.

Please if someone can help i would be very grateful! \<3

I posted how the elements are conected all together (i hope it is all ok!)

Ty very much!!

 ![spoj gotov,sve spojeno na njega.png](https://europe1.discourse-cdn.com/arduino/original/4X/9/e/e/9ee9930f0051daecb6c0eadebee556cb878b1496.png)

---

<div class="post-metadata">

**Author:** ![slipstick](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@slipstick](https://forum.arduino.cc/u/slipstick)\
**Post date:** [May 18, 2020, 3:53pm UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/2 "2020-05-18T15:53:10Z")

</div>

Many people have made arduino cars controlled by Bluetooth before. Google "Arduino bluetooth car" and you'll find lots of projects including the code for them.

Steve

---

<div class="post-metadata">

**Author:** ![vinceherman](https://avatars.discourse-cdn.com/v4/letter/v/e8c25b/32.png) [@vinceherman](https://forum.arduino.cc/u/vinceherman)\
**Post date:** [May 18, 2020, 5:49pm UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/3 "2020-05-18T17:49:11Z")

</div>

> lepi11:  
> Hello 🙂  
> Can somebody help me to write a code for my bluetooth controlled car

Hi lepi11, welcome to the forum.  
We love to help with projects like this.  
What have you been able to do so far?

---

<div class="post-metadata">

**Author:** ![lepi11](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lepi11](https://forum.arduino.cc/u/lepi11)\
**Post date:** [May 19, 2020, 10:40am UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/4 "2020-05-19T10:40:38Z")

</div>

> vinceherman:  
> Hi lepi11, welcome to the forum.  
> We love to help with projects like this.  
> What have you been able to do so far?

Hello!  
Thank you for replying.. I need someone that could help me writing a working code in arduino for my project. I need to make a code for my car that would be controlled by a phone app (which i also need to make,and if someone knows that too i would really appreciate!), so i thing the easiest is to make 4 buttons: forward,backwards and for servo steering left and right. I don't know how to write all this in an arduino because i am a beginner in this and i need it for my school project.

if someone can help me i would be very thankful, and i don't know how things work in here?.. do i pay for someones help or what?  
Thank you!

---

<div class="post-metadata">

**Author:** ![lepi11](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lepi11](https://forum.arduino.cc/u/lepi11)\
**Post date:** [May 19, 2020, 11:14am UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/5 "2020-05-19T11:14:39Z")

</div>

> slipstick:  
> Many people have made arduino cars controlled by Bluetooth before. Google "Arduino bluetooth car" and you'll find lots of projects including the code for them.
> 
> Steve

Hello!

I can't seem to find this one that I need(servo for steering and 2 DC motors one for each wheel in the back)

---

<div class="post-metadata">

**Author:** ![slipstick](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@slipstick](https://forum.arduino.cc/u/slipstick)\
**Post date:** [May 19, 2020, 11:40am UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/6 "2020-05-19T11:40:07Z")

</div>

You need use a little initiative. Try adding "servo steering" to the query i.e. "arduino car bluetooth servo steering". I can see several complete projects on the first page or two. I can't tell if any are EXACTLY what you want because you've given us no details except "DC motors" (there are thousands of different ones) and "servo" (there are loads of those too).

Or if you don't really mean "help" you mean you want someone to just write the whole code for you then try asking in Gigs and Collaborations further down the main page. You'll almost certainly need to pay for it and it may take a while. But that sounds like cheating to me, getting someone else to do your school project for you.

Steve

---

<div class="post-metadata">

**Author:** ![vinceherman](https://avatars.discourse-cdn.com/v4/letter/v/e8c25b/32.png) [@vinceherman](https://forum.arduino.cc/u/vinceherman)\
**Post date:** [May 19, 2020, 12:27pm UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/7 "2020-05-19T12:27:39Z")

</div>

> lepi11:  
> Hello!  
> Thank you for replying.. I need someone that could help me writing a working code in arduino for my project. I need to make a code for my car that would be controlled by a phone app (which i also need to make,and if someone knows that too i would really appreciate!), so i thing the easiest is to make 4 buttons: forward,backwards and for servo steering left and right. I don't know how to write all this in an arduino because i am a beginner in this and i need it for my school project.
> 
> if someone can help me i would be very thankful, and i don't know how things work in here?.. do i pay for someones help or what?  
> Thank you!

Huh. I asked what you have been able to do so far and you mostly re-state the original requirement.

Let me be more clear in what I am asking.

What have you been able to do so far?

- Do you have an arduino?
- Have you uploaded a simple test sketch like Blink to confirm that you can put sketches on the arduino?
- Have you purchased the servo?
- Have you uploaded the Sweep tutorial sketch to confirm that you can make the servo work?
- Have you purchased the motors and motor drivers?
- Have you uploaded a sketch to test the motors? (many drivers come with libraries and examples)
- Have you purchased the blue tooth module?
- Have you uploaded the test sketch that comes with mose modules to test the bluetooth communication?

---

<div class="post-metadata">

**Author:** ![lepi11](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lepi11](https://forum.arduino.cc/u/lepi11)\
**Post date:** [May 23, 2020, 12:47pm UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/8 "2020-05-23T12:47:40Z")

</div>

Hello, can you help me?  
So i put a simple code to test my DC motor and L298 motor drive if evertything works but it doesn't...  
So here is the code i tried and i posted a picture of everything connected:

#define in1 3  
#define in2 4

Void setup () {  
pinMode (in1, OUTPUT) ;  
pinMode (in2, OUTPUT) ;

digitalWrite (in1, LOW) ;  
digitalWrite (in2, LOW) ;  
}

void loop () {

digitalWrite (in1, LOW) ;  
digitalWrite (in2, LOW) ;

digitalWrite (in1, HIGH) ;  
digitalWrite (in2, LOW) ;  
delay (10000)

digitalWrite (in1, LOW) ;  
digitalWrite (in2, LOW) ;

digitalWrite (in1, LOW) ;  
digitalWrite (in2, HIGH) ;  
delay (10000);

}

---

<div class="post-metadata">

**Author:** ![slipstick](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@slipstick](https://forum.arduino.cc/u/slipstick)\
**Post date:** [May 23, 2020, 3:14pm UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/9 "2020-05-23T15:14:25Z")

</div>

There's no picture.

The code as you posted it won't even compile. You can't spell void as Void. C++ is case sensitive. And you have a ; missing from one line.

Other than those errors it looks like it may be o.k. It depends exactly what L298 Motor Driver you have. The L298 IC needs an enable signal but that may be sorted out with a jumper on the motor driver board. Does the code do anything at all when you have fixed it?

Also it's important to know what motors you have and how you are powering both the Arduino and the motor driver.

Steve

---

<div class="post-metadata">

**Author:** ![lepi11](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lepi11](https://forum.arduino.cc/u/lepi11)\
**Post date:** [May 24, 2020, 11:32am UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/10 "2020-05-24T11:32:28Z")

</div>

Here is the picture of everything connected..

 ![IMG_20200524_123518-min.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/e/1/1/e112765d1acdf9f2e922388b740670ca99361935.jpeg)

---

<div class="post-metadata">

**Author:** ![lepi11](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lepi11](https://forum.arduino.cc/u/lepi11)\
**Post date:** [May 24, 2020, 2:09pm UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/11 "2020-05-24T14:09:50Z")

</div>

> slipstick:  
> There's no picture.
> 
> The code as you posted it won't even compile. You can't spell void as Void. C++ is case sensitive. And you have a ; missing from one line.
> 
> Other than those errors it looks like it may be o.k. It depends exactly what L298 Motor Driver you have. The L298 IC needs an enable signal but that may be sorted out with a jumper on the motor driver board. Does the code do anything at all when you have fixed it?
> 
> Also it's important to know what motors you have and how you are powering both the Arduino and the motor driver.
> 
> Steve

Can you explain to me why when i measure with my multimeter 6\*1,5 V (9V) batteries i get on multimeter saying 9V BUT when i connect batteries to the motor driver i only get 2.3V.. Where do i lose 4V??????

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 24, 2020, 2:16pm UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/12 "2020-05-24T14:16:02Z")

</div>

> lepi11:  
> Where do i lose 4V??????

It's a "feature" of the L298, according to its datasheet:

 ![298 volt drop.GIF](https://europe1.discourse-cdn.com/arduino/original/4X/9/3/7/9378b0702775de313aa7ffa765058cce8c33f435.gif)

You lose 1.8V always, and as much as 4.9V if there's substantial current.

---

<div class="post-metadata">

**Author:** ![slipstick](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@slipstick](https://forum.arduino.cc/u/slipstick)\
**Post date:** [May 24, 2020, 4:08pm UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/13 "2020-05-24T16:08:26Z")

</div>

Your picture shows a little 9V block battery and they are useless for powering motors.

BTW where exactly are you measuring your 2.3V?

Steve

---

<div class="post-metadata">

**Author:** ![lepi11](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lepi11](https://forum.arduino.cc/u/lepi11)\
**Post date:** [May 25, 2020, 7:16am UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/14 "2020-05-25T07:16:42Z")

</div>

> finola\_marsaili:  
> It's a "feature" of the L298, according to its datasheet:
> 
> ![298 volt drop.GIF](https://europe1.discourse-cdn.com/arduino/original/4X/9/3/7/9378b0702775de313aa7ffa765058cce8c33f435.gif)
> 
> You lose 1.8V always, and as much as 4.9V if there's substantial current.

So what do I do now?  
Do I need 8×1,5 V batteries so it would give me 12V or do i need Something else?

---

<div class="post-metadata">

**Author:** ![lepi11](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@lepi11](https://forum.arduino.cc/u/lepi11)\
**Post date:** [May 25, 2020, 8:15am UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/15 "2020-05-25T08:15:01Z")

</div>

> slipstick:  
> Your picture shows a little 9V block battery and they are useless for powering motors.
> 
> BTW where exactly are you measuring your 2.3V?
> 
> Steve

So which battery do i need to use for powering 2 dc motors?

Wait i will take picture how i meausure

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 11:44am UTC](https://forum.arduino.cc/t/need-help-in-code-for-my-arduino-bluetooh-car/655654/16 "2021-05-06T11:44:25Z")

</div>

Closed on May 6, 2021, 11:44am UTC


