Hey guys. I am trying to build an easy program where I can control my Arduino RC car with a Bluetooth connection. I'm using the HC-05 Bluetooth module to communicate with my Arduino UNO. I'm also using an Adafruit motor shield on top of the Arduino to control the four DC motors that I have. When I verify my code everything seems fine, and the upload itself happens without any errors. But when i want to steer it with my phone nothing happens. Heres my code:¨
I'm not that good at Arduino coding so are there any obvious mistakes in my code? And also the RX and TX pins on the HC-05 are connected to the analog pins on the motor shield. Hope you guys have any suggestions
Im using and android phone to control the car. And before i connect the red led light on the bluetooth module flashes evvery second, and when paired it flashes in waves. The app is called "arduino bluetooth controller" by Condivisione
Hi,
I'm not sure how that app works, as I have an iPhone. I normally use Blynk for this type of thing. Maybe it has something to do with the val? Maybe incorrect? Try attaching the Arduino to your computer with a usb cable and add some Serial.print to see if it's working.
No. Me and my project partner wrote it ourselves. SO i do not have any link. But i can see on the internet that a lot of people have done something similiar. And i have tried everything, but nothing seems to work.
Hi,
I just noticed that you have RX and TX of HC-05 connected to A1 and A3 respectively. I wouldn't use a analog pin for the RX and TX pins, because I'm not sure it would work. I also notice that you have this:
That means you are sending the received val back to the HC-05 to transmit again. I'm not sure if that's correct.
There is no problem using the analog input pins (A0-A5) with SoftwareSerial. Those pins are digital pins like any others, but they have the special function of analog input. I actually tested the code with an Uno and the HC05 works fine on A1 and A3.
I suggest that you start the hardware serial port so that you can insert serial prints in the code to follow program execution and monitor the values of variables.
Sadly nothing happens. I'm starting to think that maybe some of my components are broken or something. But i tried the code earlier, and it worked perfectly fine, but out of nowhere it doesnt work
In the Arduino Bluetooth Controller app, which controller are you using? Controller, Switch, Dimmer or Terminal? If Controller, did you edit the output from the buttons? Is the HC05 connected to the app?
I have been investigating the AF motor shield schematic and it appears that the motor shield does not use the analog input pins (A0-A5) so the shield should have no effect.
I tried your code and wiring on my Uno (without a motor shield), HC05 and Android tablet running the Arduino Bluetooth Controller app. The HC05 communicates with the Uno just fine and if I send commands from the terminal I get the responses from the HC05.
Hi,
I think the problem is with the data being transmitted and received on Bluetooth. I don’t have that app though or an android phone, so I’m not sure.
So you had exactly the same code and exactly the same components working perfectly? And then they stopped working? So you changed something. What? It can be as simple as moving the project and breaking a wire/connection.
If you’re certain that absolutely nothing changed then a component has suddenly died. Very rare but not completely impossible.