У меня есть Arduino Uno и модуль Bluetooth HC-05.
По сути, я хочу отправлять данные String и Int вместе через Bluetooth.
КОД
Код: Выделить всё
#include
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&)'
}
Согласно веб-сайту Arduino, она имеет 2 функции.
Код: Выделить всё
- Serial.write(val)
- Serial.write(str)
Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/464 ... th-arduino
Мобильная версия