esp8266使用arduinoJson与tft_espi库发生冲突解决方法

arduinoJson与tft_espi库发生冲突解决方法

下载arduinoJson5.0版本的,不要用最新版本

 

示范代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright Benoit Blanchon 2014
// MIT License
//
// Arduino JSON library
// https://github.com/bblanchon/ArduinoJson
 
#include <ArduinoJson.h>
 
void setup() {
  Serial.begin(9600);
 
  StaticJsonBuffer<200> jsonBuffer;
 
  char json[] =
      "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
 
  JsonObject& root = jsonBuffer.parseObject(json);
 
  if (!root.success()) {
    Serial.println("parseObject() failed");
    return;
  }
 
  const char* sensor = root["sensor"];
  long time = root["time"];
  double latitude = root["data"][0];
  double longitude = root["data"][1];
 
  Serial.println(sensor);
  Serial.println(time);
  Serial.println(latitude, 6);
  Serial.println(longitude, 6);
}
 
void loop() {
  // not used in this example
}

  

posted @   txwtech  阅读(81)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2021-08-10 vnc server远程安装报错,不支持远程安装,只能本机安装
点击右上角即可分享
微信分享提示