-
Right now my code able to send int data to server but how do I send data that consists of 2 decimal number?
-
How do I post 2 data?
char mystr[40];
sprintf(mystr,"%u,%u",a,b);
int httpResponseCode = http.POST(mystr);
Right now my code able to send int data to server but how do I send data that consists of 2 decimal number?
How do I post 2 data?
char mystr[40];
sprintf(mystr,"%u,%u",a,b);
int httpResponseCode = http.POST(mystr);
Not sure what you want to do. Are the "decimal" numbers float data type? If you want to change floats so that you can put them into a string, use dtostrf().
char mystr[40];
float pi = 3.14;
void setup()
{
Serial.begin(115200);
char pistr[6];
dtostrf(pi, 6, 2, pistr);
sprintf(mystr, "The value of pi = %s", pistr);
Serial.println(mystr);
}
void loop()
{
}
BrandonKHJ:
2) How do I post 2 data?
Have you looked up how a POST request is formed?
https://www.w3schools.com/tags/ref_httpmethods.asp:
name1=value1&name2=value2
Try implement this with sprintf.