Udp write problem

Hello,

I’m running in to a problem when sending UDP packages. I use the following command (included below). In principle this is working fine, sending aswel as received and read back the data through scanf works without problem.

But what strikes me is that in "Udp.write (retourzendenbuffer, 100);"variable “retourzendenbuffer” isn’t filled with the current value but defaults to the previous value. That means that my data is always one admission behind.

Both Serial.print functions show the correct information.

Does anyone have an explanation and/or possible solution?

Keep in mind that most variables are in Dutch, if you have any troubles regarding the code feel free to get in touch!

if(zenden==true) {

sprintf(retourzendenbuffer,"%s %s %s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d",buitentemp1,aanvoertemp1,retourtemp1,stooklijn,SetPoint,Standklep,pomp,klep,keuze, b,a,r,minstand2,maxstand2,_statusVloerverw,minuutnal1,secondenal1,uurontk,minuutontk1, secondeontk1); Serial.print("retourzenden0= ");

Serial.print("retourzenden0= "); Serial.println(retourzendenbuffer);

Udp.beginPacket(remoteIP,remotePort);

Udp.write(retourzendenbuffer,100); Udp.endPacket();

Serial.print("retourzenden1= "); Serial.println(retourzendenbuffer);

zenden=false;

}

All three Udp methods return values. Perhaps the value returned, that you discard, would present a clue by four.

You should post all your code, and please use code tags.