I am new to Arduino and I have been working on a problem that has been troubling me for a few days.
I have an Arduino Uno and an HC-05 Bluetooth module.
Basically I want to send String and Int data together through Bluetooth.
CODE
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX | TX
void setup(void) {
// Arduino setup
Serial.begin(9600);
// setting the baud rate of bluetooth
BTSerial.begin(38400); // HC-05 default speed in AT command more
}
void loop(void) {
int num = 123;
BTSerial.write("#"); // Works
BTSerial.write(num); // works
BTSerial.write(String(num) + "#");
// Error: no matching function for call to 'SoftwareSerial::write(StringSumHelper&)'
}
Also the result string should have '#' character at last.
According to the Arduino Website, it has 2 functions.
- Serial.write(val)
- Serial.write(str)
Any help appreciated.
Thank you.