GithubHelp home page GithubHelp logo

streaming's Introduction

Streaming

Library Information

Name
Streaming
Version
6.1.1
License
GNU LGPL
URL
https://github.com/janelia-arduino/Streaming
Authors
Mikal Hart, gazoodle, victorh800, sebdelsol, Peter Polidoro
Maintainer
Peter Polidoro
Email
[email protected]

Description

Streaming C++-style Output with Operator <<. Supports _DEC, _BIN, _HEX, _OCT, _FLOAT, _PAD, _WIDTH, _WIDTHZ and _FMT stream helpers. See example code for usage details.

Examples

const int lettera = 'A';
const int month = 4, day = 17, year = 2009;
const int hour = 8, minute = 20, second = 3;
const float pi = 3.14159;

Serial << "This is an example of the new streaming" << endl;
Serial << "library.  This allows you to print variables" << endl;
Serial << "and strings without having to type line after" << endl;
Serial << "line of Serial.print() calls.  Examples: " << endl;

Serial << "A is " << lettera << "." << endl;
Serial << "The current date is " << day << "-" << month << "-" << year << "." << endl;

Serial << "You can use modifiers too, for example:" << endl;
Serial << _BYTE(lettera) << " is " << _HEX(lettera) << " in hex. " << endl;
Serial << endl;

Serial << "In library v6, you also get" << endl;
Serial << "Padding [" << _PAD(10, '*') << "]" << endl;
Serial << "Width specification [" << _WIDTH(10, 5) << "]" << endl;
Serial << "Leading zeros [" << _WIDTHZ(month,2) << "]" << endl;
Serial << _FMT("Format strings for stuff like dates and times %/%/% %:%:%",
  _WIDTHZ(day, 2), _WIDTHZ(month, 2), year,
  _WIDTHZ(hour,2), _WIDTHZ(minute, 2), _WIDTHZ(second,2)) << endl;
Serial << _FMT(F("To reduce your % size, these % can be in %"), F("sketch"), F("constants"), F("PROGMEM")) << endl;
Serial << endl;

Serial << "pi to 3 digits = " << _FLOAT(pi,3) << endl;

Caveats

  • There may be issues using this library with some STL features.
  • The esp8266 Arduino core declares several “Stream& operator <<” in StreamDev.h and defines them in StreamSend.cpp. If you wish to use this library with the esp8266, you may need to comment out those lines in StreamDev.h and StreamSend.cpp.

Original Source by Mikal Hart

http://arduiniana.org/libraries/streaming/

streaming's People

Contributors

gazoodle avatar peterpolidoro avatar sebdelsol avatar victorh800 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.