I am writing a sketch to send data to a python program via ethernet. The easy way, from the Python point of view, is to combine everything into a string and send that string in one client.print command.
The problem is that I don't know haw to combine the variables and string. What is the right way of doing what I tried to do in the following?
I thought that that was a good idea too, in fact it was the first thing that I tried, but only the first, and sometimes the second client.print would show up in my Python. I tried a whole bunch of things in Python before I went back to the Arduino to try sending data in a different format.
What I found was that as long as the data was in one client.print, even a thousand characters would transfer successfully.
It is working. The only additional problem was that I could not get a float to work, %f, so I scaled the one value by a factor of ten and sent it as an integer too.
int sensread = analogRead(3);
float degreex = Temperature(sensread);
int degreedec = 10*degreex;
char allin[45];
sprintf(allin, "Temperature = %i, Analogue is %i", degreedec, sensread);
client.print(allin);