Hello everyone, I am currently working on a project on Bluetooth.
I can send any text data from the app to the arduino.
But now I need to send data from arduino to the app. I searched the Internet, but I didn't find anything suitable. Please help me?
Code from arduino:
#include <BluetoothSerial.h>
BluetoothSerial SerialBT;
void setup() {
pinMode(18, INPUT_PULLUP);
Serial.begin(9600);
SerialBT.begin("BluetoothExample"); // change to your desired name
}
void loop() {
if (digitalRead(18) == LOW) {
function5();
}
}
void function5() {
Serial.println("function5");
delay(1000); // replace with actual task for mode 5
SerialBT.write((uint8_t) '!'); // send "!" symbol via Bluetooth
}
The algorithm should be like this:
When the button is pressed, Arduino sends the "!" symbol to the application. The application accepts the symbol, and sends the "|" symbol in response after 10 seconds