Be aware that I don't know Korean, and I have never personally used an Arduino,
so I am sticking to what I know in advising you ...
You are complaining about receiving garbage from AI2 in the Arduino.
The last person with that problem on this board had reversed
the receive and transmit wires between their BlueTooth board and
their Arduino.
I advise posting your wiring diagram or a good photo here,
so some one more experienced can double check that.
Another possibility is that you are sending your messages from AI2 as text,
but you are receiving them directly into non-text numeric fields,
if(bluetooth.available()){
int a = bluetooth.read();
//delay(4000);
Serial.println(a);
if(a == 1)
You capture the incoming Bluetooth message into an int variable a,
using a bluetooth.read() command and use integer comparisons from there onwards.
Here's a research problem for you ...
Just as there is a difference between the write and print commands in encoding,
is there another command like maybe bluetooth.get to do conversion from text to int instead of bluetooth.read ?
Or can you do the conversion using an extra string variable, and explicitly convert from the string to the int variable using math or string commands?
Other observations on your blocks ...
You repeat the same blocks at least 4 times in your ai2 button Click events.
A common procedure would reduce your block count.
You are analyzing your input stream in the same button.click events that send data to the Arduino.
Because the data does not arrive instantaneously, that is an inappropriate place to look for it.
Do your analysis in the Clock.Timer routine, and if necessary leave yourself a note in a global variable
that you sent something, if that's important to know.
you open Screen1.
That's always a mistake, leading to running out of memory.
Instead, close your screen and you should return to Screen1.
Beware, switching screens breaks your connections.
ABG