I am running this from the WiFi client
sprintf(allDroid, "%s,%s,%s,%s", hDroid, pDroid, ooDroid, devDroid);
and need to do this one the Server side :
sscanf(allDroid, "%s,%s,%s,%s", &hDroid1, &pDroid1, &ooDroid1, &devDroid1);
NOTE all variables are char Arrays for example :
char allDroid[18]
* I seem to have an issure on the server side .. Should I be using client.read (which seems slightly different to arduino serial.read) or is there something simimlar to clientReadStringuntil ?
snprintf
. It just outputs the format instead of the formatted number. Does anyone have a clue what's causing this?
snprintf(str, sizeof(str), "%.1f", value);
puts "%.1f" in str and not 26.1
printf("%s", String(value,1).c_str());
-u _printf_float -u _scanf_float
in compiler cmdline, check platform.txt)
@bertmelis I am running this from the WiFi client
sprintf(allDroid, "%s,%s,%s,%s", hDroid, pDroid, ooDroid, devDroid);
and need to do this one the Server side :
sscanf(allDroid, "%s,%s,%s,%s", &hDroid1, &pDroid1, &ooDroid1, &devDroid1);
NOTE all variables are char Arrays for example :
char allDroid[18]
* I seem to have an issure on the server side .. Should I be using client.read (which seems slightly different to arduino serial.read) or is there something simimlar to clientReadStringuntil ?
@bertmelis
`
//declare "code-holding" vars for send
char hDroid[5] = {
"1234" }; //4 or less digits/keys eg 1234 + NULL
char pDroid[3] = {
"21" }; //2 digits/keys eg 12 + NULL
char ooDroid[4] = {
"123" }; //3 or less digits/keys eg 123 + NULL
char devDroid[5] = {
"1234" }; //4 or less digits/keys eg 9999 + NULL
char allDroid[18] = {
'\0' }; //total array count including NULL's
//declare "code-holding" vars for receive
char hDroid1[5] = {
'\0' }; //4 or less digits/keys eg 1234 + NULL
char pDroid1[3] = {
'\0' }; //2 digits/keys eg 12 + NULL
char ooDroid1[4] = {
'\0' }; //3 or less digits/keys eg 123 + NULL
char devDroid1[5] = {
'\0' }; //4 or less digits/keys eg 9999 + NULL
void setup() {
Serial.begin(115200);
}
void loop() {
sprintf(allDroid, "%s,%s,%s,%s", hDroid, pDroid, ooDroid, devDroid);
Serial.println("This is allDroid "); //show content of allDroid
Serial.println(allDroid); //show content of allDroid
delay(1000);
sscanf(allDroid, "%s,%s,%s,%s", &hDroid1, &pDroid1, &ooDroid1, &devDroid1);
Serial.println("this is hDroid1,pDroid1,ooDroid1,devDroid1 "); //show content of allDroid
Serial.println(hDroid1);
Serial.println(pDroid1);
Serial.println(ooDroid1);
Serial.println(devDroid1);
//clear the arrays
memset(allDroid, 0, sizeof(allDroid));// This line is for reset the StringReceived
memset(hDroid1, 0, sizeof(hDroid1));// This line is for reset the StringReceived
memset(pDroid1, 0, sizeof(pDroid1));// This line is for reset the StringReceived
memset(ooDroid1, 0, sizeof(ooDroid1));// This line is for reset the StringReceived
memset(devDroid1, 0, sizeof(devDroid1));// This line is for reset the StringReceived
}
`
@bertmelis and this is where the problem is specifically :
```
WiFiClient client = wifiServer.available();
if (client) {
while (client.connected()) {
while (client.available()>0) {
char c = client.read();
Serial.write(c);
}
delay(10);
}
client.stop();
```