Hi guys, complete newbie here, I only started with arduino about 3 weeks ago and have little to no experience with programming.
Anyway, I'm trying to use a virtual joystick Android app call "Joystick BT Commander" in order to control a couple of servos over bluetooth (I have a HC-06 bluetooth transceiver connected to the arduino). I have the code for the servo working with an potentiometer, so now it's time to get the app portion working.
The app puts out a string of 6 characters, with the first three being the value of the x-axis, and the other three being the y-axis. When I read the values and print them in the serial monitor they come out as the same six digit string of characters.
How to can I separate these characters in order use the first three to control one servo, and the second one to control the other? Sorry if this is really basic, as I am really new.
Here is the code I have so far, it's nothing really,
char inchar;
void setup() {
Serial1.begin(9600);
Serial.begin(9600);
}
void loop() {
if(Serial1.available() > 0) {
inchar = Serial1.read();
Serial.print(inchar);
}
}
Also, I am using the arduino mega 2560, not sure if that helps at all.
Thanks in advance for any help guys!