Skip to content

Instantly share code, notes, and snippets.

@Kazu-zamasu
Created July 30, 2016 09:49
Show Gist options
  • Save Kazu-zamasu/c3fb46afa41d4a248869584e1e936500 to your computer and use it in GitHub Desktop.
Save Kazu-zamasu/c3fb46afa41d4a248869584e1e936500 to your computer and use it in GitHub Desktop.
#include "mbed.h"
char Head[] = "{\"module\": \"hogehogehoge\",\"type\": \"channels\",\"datetime\":\"2016-06-01T12:21:11.628907163Z\",\"payload\": {\"channels\": [";
char Ch1Head[] = "{\"channel\":1,\"type\": \"i\",\"value\":";
char Ch2Head[] = "{\"channel\":2,\"type\": \"i\",\"value\":";
char Ch3Head[] = "{\"channel\":3,\"type\": \"f\",\"value\":";
char Ch4Head[] = "{\"channel\":4,\"type\": \"f\",\"value\":";
char JSONCHEND [] = "},";
char JSONSTREND [] = "]}}";
float Soil,Lux,Temp,RH;
int main() {
Soil = 350.325;// Soil sennsor Analog object
Lux = 580.065;// Lux Sensor Analog object
Temp = 25.735;// Temperature sensor Analog object
RH = 67.525;// Humidity sensor Anlog object
// UART output
printf("%s%s%.2f%s%s%.2f%s%s%.2f%s%s%.2f%s%s\r\n",Head,Ch1Head,Soil,JSONCHEND,Ch2Head,Lux,JSONCHEND,Ch3Head,Temp,JSONCHEND,Ch4Head,RH,JSONCHEND,JSONSTREND);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment