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.
Xbee.cpp
- Committer:
- Xiaofei
- Date:
- 2015-11-22
- Revision:
- 10:c6100f1f2265
- Parent:
- 9:c0955550ca13
- Child:
- 11:4e806bf0fb3d
File content as of revision 10:c6100f1f2265:
#pragma once #include "Xbee.h" Xbee::Xbee(PinName tx, PinName rx , PinName rst):_xbee(tx,rx),_rst(rst) { _rst = 0; wait(0.01); _rst = 1; wait(0.01); _xbee.baud(9600); } void Xbee::Send(const char* buffer) { while(1) { _xbee.putc('.'); _xbee.puts(buffer); if(_xbee.getc() == '.') { break; } } } void Xbee::Recv(char* buffer, const size_t& sz) { while(_xbee.readable()) { if(_xbee.getc() == '.') { _xbee.gets(buffer,sz); _xbee.putc('.'); break; } } }