Hi,
I am working on a car project controlled by a app, this app communicates with Arduino through the HC-05 module and I also use the dual H-bridge L298N module to control a DC motor. I did a sketch and everything worked without problems in Arduino Uno, however, in Arduino Mega I can't make the engines work.
Since the same sketch worked with Uno and not with Mega, I think the problem is not in the sketch but just in case the sketch will be at the end of the post. I was careful to make the pin connections at Mega, just like I did at Uno. I tested all the TX and RX pins that Mega has (0-1, 14-15, 16-17, 18-19) and tried different baud-rates in the sketch.
When I connect the app with Mega, the HC-05's blue LED flashes more slowly, indicating that it has connected with the cell phone. The Mega LED connected to the TX pin will flash in a certain order and will also flash when I activate any button I created in the app (maybe I'll try to make a video and post the link if it helps to better understand what I say).
My question is, where is the problem most likely? Would it be in Mega, in the app or in the HC-05 module? In the case of the tests I did changing the baud-rate, should I enter the AT mode of the HC-05 module and change over there, or is the change in the sketch enough?
I can post the library files that the app uses, I don't know what all the commands do but from what I researched everything is correct.
Materials used:
- Arduino Mega 2560
- HC-05 module
- Dual H-bridge L298N
- App -> Virtuino
- OS -> Android
Edit: The sketch is too long and exceeds the maximum characters of the post.
When you have a long program just add the .ino file as an attachment.
Better still, make a shortened version of the program that illustrates the problem.
Please also post the working Uno version.
...R
Edit2: I attached a photo of the Arduino Uno, a photo of the Arduino Mega and my .ino file.
Thank you Robin2 for your attention and patience.
Teste_Main_Uno.ino (11.3 KB)
