Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ASerial.h
- Committer:
- Mr_What
- Date:
- 2015-07-28
- Revision:
- 0:41ca27337c2b
- Child:
- 2:54d27fdcbe5c
File content as of revision 0:41ca27337c2b:
// Aaron Birenboim, 26jul15 // Add some common Serial methods used in Arduino sketches // // Serial inherits from stream, for which I have no docuemntation. // examples seem to indicate that stream has (at least) printf //#include "Serial.h" class ASerial { public: Serial *_serial; ASerial(Serial &s) : _serial(&s) { } void print(const char *s) { _serial->puts(s); } void print(const int i ) { _serial->printf("%d",i); } void print(const float f) { _serial->printf("%.3f",f); } void println(const char *s) { print(s); _serial->putc('\n'); } void println(const float f) { print(f); _serial->putc('\n'); } void baud(const int i) { _serial->baud(i); } int readc() { if (_serial->readable()) { char c = _serial->getc(); return((int)c); } return(-1); } };