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:
- 27:6bd26aff87e6
- Parent:
- 26:282047f761ea
- Child:
- 28:8fdfd5bffe15
--- a/Xbee.cpp Sat Nov 28 06:02:02 2015 +0000 +++ b/Xbee.cpp Sat Nov 28 06:11:43 2015 +0000 @@ -1,7 +1,7 @@ #pragma once #include "Xbee.h" -Serial pc(USBTX, USBRX); +//Serial pc(USBTX, USBRX); Xbee::Xbee(PinName tx, PinName rx , PinName rst):_xbee(tx,rx),_rst(rst) { @@ -19,32 +19,18 @@ void Xbee::Send(const char& buffer) { - while(1) + if(_xbee.writeable()) { - if(_xbee.writeable()) - { - _xbee.putc(buffer); - if(_xbee.getc() == '.') - { - break; - } - } + _xbee.putc(buffer); } } void Xbee::Recv(char& buffer) { - while(1) + while(!_xbee.readable()){} + + if(_xbee.readable()) { - if(_xbee.readable()) - { - buffer = _xbee.getc(); - break; - } - else - { - _xbee.putc('.'); - } + buffer = _xbee.getc(); } - } \ No newline at end of file