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.
Dependents: XBeeGetRSSISampleProgram Xbee_s2_RX_versao2
Revision 1:8cb27d9eec8e, committed 2013-08-16
- Comitter:
- ATKINZ117
- Date:
- Fri Aug 16 06:37:46 2013 +0000
- Parent:
- 0:d1ff6ea68ab2
- Child:
- 2:befae843036e
- Commit message:
- partly worked
Changed in this revision
| XBeeGetRssi.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/XBeeGetRssi.cpp Tue Aug 06 14:29:39 2013 +0000
+++ b/XBeeGetRssi.cpp Fri Aug 16 06:37:46 2013 +0000
@@ -9,33 +9,35 @@
}
char* XBeeGetRssi::get(){
- /*int message_counter=0;
+ //int message_counter=0;
int rssi_counter=0;
- Serial MyXbee(_tx,_rx);*/
Serial pc(USBTX,USBRX); //for debugging.
Serial _MyXbee(_tx,_rx);
+ _rssi[0]='a';
+
pc.printf("At first.\r\n");
- while(1){
- _MyXbee.printf("+++"); //entering AT command mode.
- pc.printf("sent +++\r\n");
- _MyXbee.attach(this,&XBeeGetRssi::_rssiGetter,Serial::RxIrq);
- pc.printf("waiting for xbee!\r\n");
- return _rssi;
- }
- //MyXbee.printf("ATDB\r\n");
- //wait(0.3);
- /*if(MyXbee.readable()){
- while(_xbee_message!='\0'){
- _rssi[message_counter]=MyXbee.getc();
- message_counter++;
+ _MyXbee.printf("+++"); //entering AT command mode.
+ pc.printf("sent +++\r\n");
+ wait(3.0);
+ while(_rssi[rssi_counter]!='\0'){
+ if(_MyXbee.readable()){
+ _MyXbee.printf("ATDB\r\n"); //quering rssi value
+ _rssi[rssi_counter]=_MyXbee.getc();
+ rssi_counter++;
+ pc.printf("I'm in the while loop!\r\n");
+ }else{
+ pc.printf("couldn't read.\r\n");
}
- }else{
- pc.printf("There is no message.\r\n");
- }*/
+ }_rssi[rssi_counter]='\0'; //contain rssi value to _rssi[]
+ pc.printf("Ended!\r\n");
+ _MyXbee.printf("ATCN\r\n");
+
+ return _rssi;
+
}
-void XBeeGetRssi::_rssiGetter(){
+/*void XBeeGetRssi::_rssiGetter(){
int message_counter=0;
int rssi_counter=0;
Serial pc(USBTX,USBRX);
@@ -46,7 +48,7 @@
_xbee_message[message_counter]=_MyXbee.getc();
message_counter++;
}_xbee_message[message_counter]='\0'; //get the message from xbee.
- pc.printf("contained OK_message.\r\n");
+ pc.printf("contained some message.\r\n");
pc.printf(_xbee_message);
if(strcmp(_xbee_message,"OK\r\n")==0){
@@ -62,4 +64,4 @@
pc.printf("There were some error.\r\n");
}
-}
\ No newline at end of file
+}*/
\ No newline at end of file
