I am working on a project of an arduino car it's simple really i know how to control the speed and direction using simple button but I was looking for an upgrade so I add a virtual joystick in my app now It can send 2 values first is the angle where the pointer of the joystick is which will be used to control the direction. And the distance between the center of the joystick and the pointer will be used to control the speed, problem is they are both int values how can I make the arduino differentiate between both values ? also they would be sent simultaneously over Bluetooth which might be a problem as well
Use delimiters to separate the two values you are sending over bluetooth.
On the Arduino side, read the the incoming string into a
char array and add a
\0 after the last read character to make it a C string. The use
strtok() to parse the C string and
atof() to convert the parsed C strings to an
See this answer for more information about parsing a string.
I would say it would be the best way to use a H-bridge motor driver such as L293N. With it you can simply drive a DC motor both ways and even control it's speed.
Make the connection as shown on picture below, but connect wires of both motors to the same motor and PWM_SPEED_CTRL are channels connected to the Arduino. Don't forget to add relays between pins: 3-1, 6-2 and 11-1, 14-2, which would determine the turning direction.
If you don't understand certain thing, just ask and I'll try to reply ASAP.