Hello!
I want to send Strings using SoftwareSerial library, however, it has confused me a bit.
This code compiles:
softSerial.write("hello");
This code doesn't:
String s="hello";
softSerial.write(s);
The error it presents is the following:
bluetooth_comm_v3.ino: In function 'void loop()':
bluetooth_comm_v3:22: error: no matching function for call to 'SoftwareSerial::write(String&)'
D:\Program Files\Arduino\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.h:92: note: candidates are: virtual size_t SoftwareSerial::write(uint8_t)
D:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Print.h:54: note: size_t Print::write(const char*, size_t)
D:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Print.h:53: note: virtual size_t Print::write(const uint8_t*, size_t)
D:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Print.h:49: note: size_t Print::write(const char*)
I tried converting the String to both char array or byte array and write that to the Serial instead, but that didn't work, although I maybe didn't do it correctly.
So can anyone tell me how to make the code above work?