-
-
Save parzibyte/a1c9e2c8570125d9e8e659e8bb6d2f5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int tiempoTranscurrido = 5; | |
float temperatura = 14.20; | |
float humedad = 79.20; | |
// Búfer para escribir datos en JSON | |
char bufer[50]; | |
// Crear la respuesta pasando las variables | |
// La salida será algo como: | |
// {"t":14.20,"h":79.20,"l":5.00} | |
sprintf(bufer, "{\"t\":%.2f,\"h\":%.2f,\"u\":%d}", temperatura, humedad, tiempoTranscurrido); | |
// Responder con ese JSON | |
servidor.send(200, "application/json", bufer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment