Hi,
I'm trying to connect with a Server and I have established correctly the connection using:
clientRest.setHeader("Content-Type: xxxxxxx");
clientRest.post("/token", "xxxxxxxxxx", &response);
My problem is with the size of response because when I try to parse de response, I can see that the variable response (String) doesn't have the full information, and finish before the end of the server message then, the I do the parse...I have problems:
JsonObject& root = jsonBuffer.parseObject(response);
T1 = root["t1"];
T2 = root["t2"];
I'm trying to declare the variable response how a global variable and I can see that now I have more informativo but not full information.
Any idea?
When I have compiled, the memory usage is:
El Sketch usa 22004 bytes (68%) del espacio de almacenamiento de programa. El máximo es 32256 bytes.
Las variables Globales usan 1144 bytes (55%) de la memoria dinámica, dejando 904 bytes para las variables locales. El máximo es 2048 bytes.
frasanc1:
Any idea?
would it not make sense to share your code and (in particular) explain what libraries you are using?
Hi,
Sorry, I'm using:
#include <SPI.h>
#include <MFRC522.h>
#include <Ethernet.h>
#include "RestClient.h"
#include "ArduinoJson.h"
I'm doing an access control based on NFC cards and I've to authenticate with a server to check the card. The part of the code where I have problems is:
DynamicJsonBuffer jsonBuffer(1000);
clientRest.setHeader("Content-Type: application/x-www-form-urlencoded");
clientRest.post("xxxxx", "xxxxxxxxxx", &response);
Serial.println(response);
JsonObject& root = jsonBuffer.parseObject(response);
accessToken = root["access_token"];
refreshToken = root["refresh_token"];
Serial.println(F("Imprimir access token:"));
Serial.println(accessToken);
Serial.println(F("Imprimir refresh token:"));
Serial.println(refreshToken);
When I print the variable response I can see that it is not complete. Then, I think that the parser can not run properly. I try to add a "}" at the end of the response, but doesn't work, because I can see that I have the data for token and access token at the variable response.
Ideas?
Thank you very much.