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.
Diff: Xbee.cpp
- Revision:
- 28:8fdfd5bffe15
- Parent:
- 27:6bd26aff87e6
- Child:
- 29:7b328499f9cf
--- a/Xbee.cpp Sat Nov 28 06:11:43 2015 +0000 +++ b/Xbee.cpp Sat Nov 28 13:47:44 2015 +0000 @@ -19,18 +19,31 @@ void Xbee::Send(const char& buffer) { - if(_xbee.writeable()) + while(1) { - _xbee.putc(buffer); + if(_xbee.writeable()) + { + _xbee.putc(buffer); + _xbee.putc('\0'); + } + if(_xbee.readable()) + { + break; + } } } void Xbee::Recv(char& buffer) { - while(!_xbee.readable()){} - - if(_xbee.readable()) + while(1) { - buffer = _xbee.getc(); + if(!_xbee.readable()) + { + _xbee.putc('\0'); + } + else + { + buffer = _xbee.getc(); + } } } \ No newline at end of file