B站:https://space.bilibili.com/309103931
中移4G模块-ML302专栏:https://blog.csdn.net/qq_33259323/category_10453372.html
中移4G模块-ML302文集:https://www.bilibili.com/read/readlist/rl328642
1.中移4G模块-ML302-OpenCpu开发-(固件编译和烧录)
https://blog.csdn.net/qq_33259323/article/details/108586847
https://www.bilibili.com/read/cv7876504
2.中移4G模块-ML302-OpenCpu开发-(MQTT连接阿里云)
https://blog.csdn.net/qq_33259323/article/details/108638945
https://www.bilibili.com/read/cv7876527
2.1中移4G模块-ML302-OpenCpu开发-(MQTT连接阿里云-订阅主题)
https://blog.csdn.net/qq_33259323/article/details/108960540
https://www.bilibili.com/read/cv7879954
2.2中移4G模块-ML302-OpenCpu开发-(MQTT连接阿里云-接收和发送数据)
https://blog.csdn.net/qq_33259323/article/details/108964810
https://www.bilibili.com/read/cv7886836
2.3中移4G模块-ML302-OpenCpu开发-(MQTT连接阿里云-RRPC通讯)
https://blog.csdn.net/qq_33259323/article/details/108965071
https://www.bilibili.com/read/cv7888259
3.中移4G模块-ML302-OpenCpu开发-串口开发
https://blog.csdn.net/qq_33259323/article/details/108974888
https://www.bilibili.com/read/cv7888865
4.中移4G模块-ML302-OpenCpu开发-51单片机串口转I2C
https://blog.csdn.net/qq_33259323/article/details/109020642
https://www.bilibili.com/read/cv7922942
5.中移4G模块-ML302-OpenCpu开发-MCP23017输入/输出
https://blog.csdn.net/qq_33259323/article/details/109109136
https://www.bilibili.com/read/cv7969395
7.中移4G模块-ML302-OpenCpu开发-PCF8591测量电压
https://blog.csdn.net/qq_33259323/article/details/109109266
https://www.bilibili.com/read/cv7969365
8.中移4G模块-ML302-OpenCpu开发-GPIO
https://blog.csdn.net/qq_33259323/article/details/108960947
https://www.bilibili.com/read/cv7877192
9.中移4G模块-ML302-OpenCpu开发-ADC
https://blog.csdn.net/qq_33259323/article/details/109020864
https://www.bilibili.com/read/cv7922958
10.中移4G模块-ML302-OpenCpu开发-CJSON
https://blog.csdn.net/qq_33259323/article/details/109020898
https://www.bilibili.com/read/cv7923020
11.中移4G模块-ML302-OpenCpu开发-HTTP
https://blog.csdn.net/qq_33259323/article/details/109020904
https://www.bilibili.com/read/cv7923054
中移4G模块-ML302-OpenCpu开发-CJSON
JSON转字符串
cJSON *root=NULL;
cJSON *sub_js=NULL;
char *out=NULL;
root = cJSON_CreateObject();
cJSON_AddStringToObject(root, "version", "V1.1.0");
cJSON_AddStringToObject(root, "imei", "1xxxxxxxxxxxxxxxx");
cJSON_AddItemToObject(root, "data", sub_js = cJSON_CreateObject());
cJSON_AddNumberToObject(sub_js, "status", 1);
cJSON_AddTrueToObject(sub_js, "material");
cJSON_AddTrueToObject(sub_js, "power_on");
cJSON_AddNumberToObject(sub_js, "qty", 123);
cJSON_AddStringToObject(root, "dt", "2020-01-07T05:15:52");
out=cJSON_Print(root);
cJSON_Delete(root);
cm_printf("[CJSON]:
");
cm_printf("%s
",out);
cJSON_free(out);
字符串转JSON
char * json = "{ "json" : { "id":1, "nodeId":11, "deviceId":111, "deviceName":"aaa", "ieee":"01212", "ep":"1111", "type":"bbb" }}";
char * json1 = "{"id":1, "nodeId":11, "deviceId":111, "deviceName":"aaa"}";
cJSON * root;
cJSON * format;
int value_int;
char * value_string;
root = cJSON_Parse(json);
format = cJSON_GetObjectItem(root,"json");
value_int = cJSON_GetObjectItem(format,"nodeId")->valueint;
value_string = cJSON_GetObjectItem(format,"ieee")->valuestring;
cm_printf( "%d
", value_int );
cm_printf( "%s
", value_string );
cJSON_Delete(root);
root = cJSON_Parse(json1);
value_int = cJSON_GetObjectItem(root,"id")->valueint;
value_string = cJSON_GetObjectItem(root,"deviceName")->valuestring;
cm_printf( "%d
", value_int );
cm_printf( "%s
", value_string );
cJSON_Delete(root);