IndentedPrintExample.ino 804 B

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