Hello, I hope im in good section :),
I have some troubles to get working serial communication between two arduinos. I found really nice library, where you can create a struct, it will be serialized and sent over serial. It should be deserialized and give you good results. But it doesnt work for me. When I use just integers in struct, works everything fine, but when I change to String, it doesnt work anymore. I think the problem will be probably in size of whole struct, but im not sure, im quite new in arduino.
Can anyone help me how to get around it and send strings between these two arduinos?
transmitter:
#include <EasyTransfer.h>
EasyTransfer ET;
struct SEND_DATA_STRUCTURE{
String data;
String filename;
};
//give a name to the group of data
SEND_DATA_STRUCTURE mydata;
#include <Wire.h>
void setup(){
Serial1.begin(9600);
ET.begin(details(mydata), &Serial1);
}
void loop() {
mydata.data = "text dataaaa :-)";
char temp[] = "file.txt";
mydata.filename = temp;
ET.sendData();
delay(5000);
}
Can anyone help me how to get around it and send strings between these two arduinos?
Your struct does not contain two strings. It contains two Strings. Strings are far different beasts from strings. Until 1.0.4 is released, they are to be avoided.
Replace the Strings with strings, and the transfer will work.
Can anyone help me how to get around it and send strings between these two arduinos?
Your struct does not contain two strings. It contains two Strings. Strings are far different beasts from strings. Until 1.0.4 is released, they are to be avoided.
Replace the Strings with strings, and the transfer will work.
when I replace it, I got this error .. error: 'string' does not name a type
Do I need import any library?
Maybe you need to get a book on C, and learn HOW to work with strings. The strcat() and strcpy() functions do what you have tried every which way but correctly to do.
PaulS:
Maybe you need to get a book on C, and learn HOW to work with strings. The strcat() and strcpy() functions do what you have tried every which way but correctly to do.