Hello guys, first time here, so please be patient
So, I am starting to try and interface Arduino uno with a little Bluetooth module Serial Jy-mcu Rs232
So far so good, I've been using ardudroid on my phone to turn on and off the built in LED.
when messing with it i ran into a problem, which i believe is a variable problem.
I have created the following code:
char state;
char flag = 0;
void setup()
{
 Serial.begin(9600);
 }
Â
void loop()
{
 if(Serial.available()>0)
 {
 state=Serial.read();
 Serial.println(state);
 flag = 0;
 }
 else
 {
  if (flag==0)
  {
  Serial.println("No Statement");
  }
 flag = 1;
 }
}
I works fine when i input a number on the computer serial, but when i input the number from the bluetooth it goes like:
0 is *12|99|99|0#
1 is *12|99|99|1#
2 is *12|99|99|2#
...
10 is *12|99|99|10#
a is *12|99|99|a#
b is *12|99|99|b#
ab is *12|99|99|ab#
and so forth
which i dong get, as the state variable is not a string
and since it is not a string i cant read it character by character to isolate the data that i wish
Id like to know how to obtain only the data from that variable, or how to turn the variable into a string so i can isolate the data that i want I
ve tried declaring it as a string but then the command "Serial.read" doesn't work