#include <ArduinoJson.h>
volatile int cx;
volatile int cy;
volatile char c;
String json;
void setup(){
cx = 0;
cy = 0;
c = 0;
json = "";
Serial.begin(9600);
}
void loop(){
if (Serial.available() > 0) {
c = char(Serial.read());
json = String(json) + String(c);
if (c == '}') {
StaticJsonBuffer<200> jsonBuffer;//出错
JsonObject& root = jsonBuffer.parseObject(json);//出错
int cx = root["cx"];
int cy = root["cy"];
Serial.print("cx = ");
Serial.print(cx);
Serial.print('\t');
Serial.print("cy = ");
Serial.println(cy);
json = "";
}
}
}
exit status 1
StaticJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6