esp8266使用arduinoJson与tft_espi库发生冲突解决方法
arduinoJson与tft_espi库发生冲突解决方法
下载arduinoJson5.0版本的,不要用最新版本
示范代码
// 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 }
欢迎讨论,相互学习。
cdtxw@foxmail.com