Hello,
I’m having troubles and I was wondering if anyone could help me. I’m building an app that connects to an Arduino using Bluetooth. That part works fine but what I want is this:
When the app connects to the Arduino (hc-05 module) it will change the color of a small button in the app that I’m using as an indicator from red to green and it will also send the character “V” to the arduino. When the arduino sees the “V” it is supposed to turn on a led and send the firmware version (just a string of text) to the serial monitor (using Serial.println) and also most importantly back to the app to be displayed as a label (using Serial3.println).
When the app connects, it sends the “V” just fine, the arduino sees it, turns on the LED and sends the FW version text to the serial monitor BUT NOT back to the app.
I’m including a screenshot of the block in question from the App Inventor along with the entire .aia file. The arduino code is also below.
char Incoming_value = 0; //Variable for storing Incoming_value
void setup()
{
Serial.begin(9600); // Serial Monitor
Serial3.begin(9600); // HC-05 Bluetooth Module
pinMode(53, OUTPUT); // Sets digital pin 53 as output pin
}
void loop()
{
if(Serial3.available() > 0)
{
Incoming_value = Serial3.read(); //Read the incoming data and store it into variable Incoming_value
Serial.println(Incoming_value); //Print Value of Incoming_value in Serial monitor
if(Incoming_value == ‘V’) { //Checks whether value of Incoming_value is equal to V
digitalWrite(53, HIGH); // Turn LED ON
Serial3.println(“FW VER: xxx”);
Serial.println(“FW VER: xxx”);}
}
}
Bluetooth_LED_003.aia (66.2 KB)