Arduino example are now compiling

This commit is contained in:
Benoit Blanchon
2014-11-03 21:29:55 +01:00
parent d9cc259df3
commit 699292b058
5 changed files with 104 additions and 84 deletions

View File

@ -3,41 +3,28 @@
* Benoit Blanchon 2014 - MIT License
*/
#include <JsonGenerator.h>
#include <ArduinoJson.h>
using namespace ArduinoJson::Generator;
using namespace ArduinoJson::Internals;
void setup()
{
Serial.begin(9600);
JsonObject<1> json;
json["key"] = "value";
IndentedPrint serial(Serial);
serial.setTabSize(4);
serial.println("This is at indentation 0");
serial.indent();
serial.println("This is at indentation 1");
serial.println("This is also at indentation 1");
serial.indent();
serial.println("This is at indentation 2");
serial.println("You can print JSON here, as usual:");
serial.println(json);
serial.println();
serial.println("But you can also prettyPrint JSON here:");
json.prettyPrintTo(serial);
serial.println();
serial.unindent();
serial.unindent();
serial.println("This is back at indentation 0");
void setup() {
Serial.begin(9600);
IndentedPrint serial(Serial);
serial.setTabSize(4);
serial.println("This is at indentation 0");
serial.indent();
serial.println("This is at indentation 1");
serial.println("This is also at indentation 1");
serial.indent();
serial.println("This is at indentation 2");
serial.unindent();
serial.unindent();
serial.println("This is back at indentation 0");
}
void loop()
{
void loop() {
// not used in this example
}