SOLVED - Sending Data via LAN

I have a sketch running on a UNO with a POE Ethernet shield. It reads temperatures from the analogue ports and sends them either to a browser or, to a Python program which enters them into a database.

This bit of programming:

           for(int j=0;j<6;j++)
            {            
              long senstot = 0;              
              for(int i=0;i<100;i++)
              {
                sensread = analogRead(j);
                senstot = senstot + sensread;
              }
              
              sensread = senstot/100;
              float degreex = Temperature(sensread);
              int degreedec = 10*degreex;
              char allin[45];
              sprintf(allin, "AInput #%i, Temperature = %i, Analogue is %i", j, degreedec, sensread);
              client.print(allin);
              client.println("\t");             
            }
            
            break;

generates the following desired output when queried by a browser:

AInput #0, Temperature = 759, Analogue is 505
AInput #1, Temperature = 756, Analogue is 503
AInput #2, Temperature = 749, Analogue is 498
AInput #3, Temperature = 746, Analogue is 496
AInput #4, Temperature = 467, Analogue is 304
AInput #5, Temperature = 327, Analogue is 220

I would like to send the same info (without the descriptions) to the Python database program but if I change the sprintf to:

              sprintf(allin, "%i,  %i,  %i", j, degreedec, sensread);

only the first line makes it. ie.:

1 759 505

I would like to recieve 1 759 505 2 749 498 3 … at the python program.

So it looks like I need to put all of the data into one “sprintf”. Is there an easier way to do this than putting the data into an array (ie: data [6][3]) and then writing a great long sprintf?

Thanks,
JP.

It should work. What else did you change besides the sprintf() line?

I tried taking out the

client.println("\t");

For the browser all of the information ended up on one line. For the Python prog same as before. I'm thinking that the

client.print(allin);

is adding a control character that the Python prog sees but the browser does not.

Now I am wondering is there some way I can just keep adding three more integers to the char allin each time through the loop and then send allin after the loop is done?

Something like this:

            char allin[450]; 
            for(int j=0;j<6;j++)
            {            
              long senstot = 0;              
              for(int i=0;i<100;i++)
              {
                sensread = analogRead(j);
                senstot = senstot + sensread;
              }
              
              sensread = senstot/100;
              float degreex = Temperature(sensread);
              int degreedec = 10*degreex;
              
              
              append("%i, %i, %i",j, degreedec, sensread) to allin
              
              

            }
            client.print(allin);
            client.println("\t");             
  
            
            break;

OK, I found a way to make it work. I create the data to be sent as a string, then keep adding new data on, and then change it to char once out of the loop, and it sends as desired.

Good Day, JP.