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:
- 26:282047f761ea
- Parent:
- 25:78fdcbf803c9
- Child:
- 27:6bd26aff87e6
--- a/Xbee.cpp Sat Nov 28 05:52:02 2015 +0000
+++ b/Xbee.cpp Sat Nov 28 06:02:02 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)
{
@@ -24,30 +24,27 @@
if(_xbee.writeable())
{
_xbee.putc(buffer);
- //pc.printf("%s","here");
- }
-
- if(_xbee.readable())
- {
- break;
+ if(_xbee.getc() == '.')
+ {
+ break;
+ }
}
}
}
void Xbee::Recv(char& buffer)
{
- while(!_xbee.readable())
+ while(1)
{
- if(_xbee.writeable())
- {
- _xbee.putc('.');
- }
-
if(_xbee.readable())
{
buffer = _xbee.getc();
break;
}
+ else
+ {
+ _xbee.putc('.');
+ }
}
}
\ No newline at end of file