123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #include <ArduinoJson.h>
- void setup() {
-
- Serial.begin(9600);
- while (!Serial) continue;
-
-
-
-
-
- StaticJsonDocument<200> doc;
-
-
-
-
-
-
-
-
-
-
-
-
- uint8_t input[] = {131, 166, 115, 101, 110, 115, 111, 114, 163, 103, 112, 115,
- 164, 116, 105, 109, 101, 206, 80, 147, 50, 248, 164, 100,
- 97, 116, 97, 146, 203, 64, 72, 96, 199, 58, 188, 148,
- 112, 203, 64, 2, 106, 146, 230, 33, 49, 169};
-
-
-
-
-
-
- DeserializationError error = deserializeMsgPack(doc, input);
-
- if (error) {
- Serial.print("deserializeMsgPack() failed: ");
- Serial.println(error.c_str());
- return;
- }
-
-
-
-
- const char* sensor = doc["sensor"];
- long time = doc["time"];
- double latitude = doc["data"][0];
- double longitude = doc["data"][1];
-
- Serial.println(sensor);
- Serial.println(time);
- Serial.println(latitude, 6);
- Serial.println(longitude, 6);
- }
- void loop() {
-
- }
|