IndentedPrintExample.ino 755 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright Benoit Blanchon 2014-2015
  2. // MIT License
  3. //
  4. // Arduino JSON library
  5. // https://github.com/bblanchon/ArduinoJson
  6. #include <ArduinoJson.h>
  7. using namespace ArduinoJson::Internals;
  8. void setup() {
  9. Serial.begin(9600);
  10. while (!Serial) {
  11. // wait serial port initialization
  12. }
  13. IndentedPrint serial(Serial);
  14. serial.setTabSize(4);
  15. serial.println("This is at indentation 0");
  16. serial.indent();
  17. serial.println("This is at indentation 1");
  18. serial.println("This is also at indentation 1");
  19. serial.indent();
  20. serial.println("This is at indentation 2");
  21. serial.unindent();
  22. serial.unindent();
  23. serial.println("This is back at indentation 0");
  24. }
  25. void loop() {
  26. // not used in this example
  27. }