Hello! I am trying to build an app to send movement commands to a robot with bluetooth and receive a signal if a PIR sensor has detected movement and display a notification. Right now I am just trying to test the bluetooth communication. The transfer of data from the phone to arduino works well, but the data I am trying to send through the serial monitor to the phone doesn't seem to be received. Here is the app I currently have:
I don't really care about what is received, that's why I have a label that should be set to the number of bytes just for debug, but nothing is happening. I just care about the notification. And here is the arduino code I am using for testing:
#include <SoftwareSerial.h>
// Create a SoftwareSerial object
SoftwareSerial bluetooth(2, 3); // RX, TX
void setup() {
// Begin serial communication with the Arduino IDE (Serial Monitor)
Serial.begin(9600);
// Begin serial communication with the Bluetooth module
bluetooth.begin(9600);
// Print a message to the serial monitor
Serial.println("Bluetooth Test");
}
void loop() {
if (bluetooth.available()) {
// Read a character from the Bluetooth module
char c = bluetooth.read();
// Print the character to the serial monitor
Serial.print(c);
}
// Check if data is available to read from the Serial Monitor
if (Serial.available()) {
// Read a character from the Serial Monitor
char c = Serial.read();
// Send the character to the Bluetooth module
bluetooth.println(c);
}
}
I tried to set the delimiter byte of the bluetooth client to 10 to stop at a newline but it didn't do anything. I would need any ideas and I appreciate any help! Thank you!