Examples: remove outdated comments

This commit is contained in:
Benoit Blanchon
2023-07-20 14:45:53 +02:00
parent 727a1013ca
commit b69a952e69
7 changed files with 0 additions and 42 deletions

View File

@ -24,11 +24,6 @@
#include <SPI.h> #include <SPI.h>
// Our configuration structure. // Our configuration structure.
//
// Never use a JsonDocument to store the configuration!
// A JsonDocument is *not* a permanent storage; it's only a temporary storage
// used during the serialization phase. See:
// https://arduinojson.org/v6/faq/why-must-i-create-a-separate-config-object/
struct Config { struct Config {
char hostname[64]; char hostname[64];
int port; int port;
@ -43,8 +38,6 @@ void loadConfiguration(const char* filename, Config& config) {
File file = SD.open(filename); File file = SD.open(filename);
// Allocate a temporary JsonDocument // Allocate a temporary JsonDocument
// Don't forget to change the capacity to match your requirements.
// Use https://arduinojson.org/v6/assistant to compute the capacity.
JsonDocument doc; JsonDocument doc;
// Deserialize the JSON document // Deserialize the JSON document
@ -75,8 +68,6 @@ void saveConfiguration(const char* filename, const Config& config) {
} }
// Allocate a temporary JsonDocument // Allocate a temporary JsonDocument
// Don't forget to change the capacity to match your requirements.
// Use https://arduinojson.org/assistant to compute the capacity.
JsonDocument doc; JsonDocument doc;
// Set the values in the document // Set the values in the document

View File

@ -15,25 +15,18 @@ void setup() {
continue; continue;
// Allocate the JSON document // Allocate the JSON document
//
// Inside the parentheses, 200 is the RAM allocated to this document.
// Don't forget to change this value to match your requirement.
// Use https://arduinojson.org/v6/assistant to compute the capacity.
JsonDocument doc; JsonDocument doc;
// Add values in the document // Add values in the document
//
doc["sensor"] = "gps"; doc["sensor"] = "gps";
doc["time"] = 1351824120; doc["time"] = 1351824120;
// Add an array. // Add an array.
//
JsonArray data = doc.createNestedArray("data"); JsonArray data = doc.createNestedArray("data");
data.add(48.756080); data.add(48.756080);
data.add(2.302038); data.add(2.302038);
// Generate the minified JSON and send it to the Serial port. // Generate the minified JSON and send it to the Serial port.
//
serializeJson(doc, Serial); serializeJson(doc, Serial);
// The above line prints: // The above line prints:
// {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]}
@ -42,7 +35,6 @@ void setup() {
Serial.println(); Serial.println();
// Generate the prettified JSON and send it to the Serial port. // Generate the prettified JSON and send it to the Serial port.
//
serializeJsonPretty(doc, Serial); serializeJsonPretty(doc, Serial);
// The above line prints: // The above line prints:
// { // {

View File

@ -78,7 +78,6 @@ void setup() {
} }
// Allocate the JSON document // Allocate the JSON document
// Use https://arduinojson.org/v6/assistant to compute the capacity.
JsonDocument doc; JsonDocument doc;
// Parse JSON object // Parse JSON object

View File

@ -15,20 +15,9 @@ void setup() {
continue; continue;
// Allocate the JSON document // Allocate the JSON document
//
// Inside the parentheses, 200 is the capacity of the memory pool in bytes.
// Don't forget to change this value to match your JSON document.
// Use https://arduinojson.org/v6/assistant to compute the capacity.
JsonDocument doc; JsonDocument doc;
// JSON input string. // JSON input string.
//
// Using a char[], as shown here, enables the "zero-copy" mode. This mode uses
// the minimal amount of memory because the JsonDocument stores pointers to
// the input buffer.
// If you use another type of input, ArduinoJson must copy the strings from
// the input to the JsonDocument, so you need to increase the capacity of the
// JsonDocument.
char json[] = char json[] =
"{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}"; "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";

View File

@ -57,7 +57,6 @@ void loop() {
client.read(); client.read();
// Allocate a temporary JsonDocument // Allocate a temporary JsonDocument
// Use https://arduinojson.org/v6/assistant to compute the capacity.
JsonDocument doc; JsonDocument doc;
// Create the "analog" array // Create the "analog" array

View File

@ -47,7 +47,6 @@ void setup() {
void loop() { void loop() {
// Allocate a temporary JsonDocument // Allocate a temporary JsonDocument
// Use https://arduinojson.org/v6/assistant to compute the capacity.
JsonDocument doc; JsonDocument doc;
// Create the "analog" array // Create the "analog" array

View File

@ -16,20 +16,9 @@ void setup() {
continue; continue;
// Allocate the JSON document // Allocate the JSON document
//
// Inside the parentheses, 200 is the capacity of the memory pool in bytes.
// Don't forget to change this value to match your JSON document.
// Use https://arduinojson.org/v6/assistant to compute the capacity.
JsonDocument doc; JsonDocument doc;
// MessagePack input string. // MessagePack input string.
//
// Using a char[], as shown here, enables the "zero-copy" mode. This mode uses
// the minimal amount of memory because the JsonDocument stores pointers to
// the input buffer.
// If you use another type of input, ArduinoJson must copy the strings from
// the input to the JsonDocument, so you need to increase the capacity of the
// JsonDocument.
uint8_t input[] = {131, 166, 115, 101, 110, 115, 111, 114, 163, 103, 112, 115, 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, 164, 116, 105, 109, 101, 206, 80, 147, 50, 248, 164, 100,
97, 116, 97, 146, 203, 64, 72, 96, 199, 58, 188, 148, 97, 116, 97, 146, 203, 64, 72, 96, 199, 58, 188, 148,