StreamingExample.ino 793 B

12345678910111213141516171819202122232425262728293031
  1. #include <Streaming.h>
  2. const long BAUD = 115200;
  3. const int lettera = 'A';
  4. const int month = 4, day = 17, year = 2009;
  5. const long LOOP_DELAY = 1000;
  6. void setup()
  7. {
  8. Serial.begin(BAUD);
  9. }
  10. void loop()
  11. {
  12. Serial << "This is an example of the new streaming" << endl;
  13. Serial << "library. This allows you to print variables" << endl;
  14. Serial << "and strings without having to type line after" << endl;
  15. Serial << "line of Serial.print() calls. Examples: " << endl;
  16. Serial << "A is " << lettera << "." << endl;
  17. Serial << "The current date is " << day << "-" << month << "-" << year << "." << endl;
  18. Serial << "You can use modifiers too, for example:" << endl;
  19. Serial << _BYTE(lettera) << " is " << _HEX(lettera) << " in hex. " << endl;
  20. Serial << endl;
  21. delay(LOOP_DELAY);
  22. }