print issue

count_sent_serve=0;
int i=random(1,5000);
count_sent_server++;
sprintf(message,"@%s<%d>p%dq#","deviceA",i,count_sent_server);
Serial.print(message);

In 80% cases,it prints correct, i.e like @deviceA<1238>p78q#. I have seen that it has printed <2798>p5q#, sometime q#, sometime @@@@@@@@<1014>p90q#

Why guys? Thanks in advance

bug is line 42 and your red wire is not plugged in firmly... not 100% sure though - just from what I can see

:)

joke aside - do you think you shared enough info?

Why don’t you just use multiple Serial.print with just the elements you want without wasting memory for the message buffer and the huge binary of the sprintf function

We do not usually deal with snippets here. Without seeing the remainder of the program, I do not know the answer.

Are count_sent_serve and count_sent_server intended to be different?

Nah, problem is in line 11 where message is declared.