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.
Dependencies: XBeeLib mbed-rtos mbed
Revision 8:62898720a01d, committed 2017-12-05
- Comitter:
- ghivert
- Date:
- Tue Dec 05 19:36:25 2017 +0000
- Parent:
- 7:46889f2aa444
- Child:
- 10:29d5ca2beffb
- Commit message:
- final?;
Changed in this revision
--- a/Capteurs/Sensors.cpp Mon Dec 04 21:34:32 2017 +0000
+++ b/Capteurs/Sensors.cpp Tue Dec 05 19:36:25 2017 +0000
@@ -21,9 +21,12 @@
read_RTD(RTDBuf);
read_PH(phBuf);
- //sprintf(TxBuf,"%s;%s;%s",RTDBuf+1,phBuf+1,ECBuf+1);
- sprintf(TxBuf,"%s;%s;%s","1.1","2.2","3.3");
- pc.printf("%s\n",TxBuf);
- xbee_broadcast(TxBuf,strlen(TxBuf)+1);
- pc.printf("TxBuf strlen: %i\n",strlen(TxBuf));
+ //sprintf(TxBuf,"%s;%s;%s",RTDBuf+1,phBuf+1,ECBuf+1);
+ sprintf(TxBuf,"%s;%s;%s;\0","1.1","2.2","3.3");
+ pc.printf("%s\n",TxBuf);
+ RemoteXBeeZB xbzb = get_remote_node();
+ const RemoteXBeeZB& remoteDevice = xbzb;
+
+ xbee_send(remoteDevice, TxBuf, strlen(TxBuf));
+ pc.printf("TxBuf strlen: %i\n",strlen(TxBuf));
}
\ No newline at end of file
--- a/Xbee/xbeeutils.cpp Mon Dec 04 21:34:32 2017 +0000
+++ b/Xbee/xbeeutils.cpp Tue Dec 05 19:36:25 2017 +0000
@@ -133,17 +133,10 @@
if (txStatus != TxStatusSuccess) {
(*pc).printf("An error happened while sending data to remote coordinator %d\r\n", txStatus);
}
-
}
-void test(){
- char buf[]="1;2;3";
- RemoteXBeeZB xbzb = xbee->get_remote_node_by_id("fixe");
- (*pc).printf("0x%X\n",xbzb.get_addr64());
-
- const RemoteXBeeZB& remoteDevice = xbzb;
-
- xbee->send_data(remoteDevice, (const uint8_t *)buf, strlen(buf));
+RemoteXBeeZB get_remote_node() {
+ return xbee->get_remote_node_by_id("Router");
}
void xbee_send(const RemoteXBeeZB& xbzb, char * msg, int length){
--- a/Xbee/xbeeutils.h Mon Dec 04 21:34:32 2017 +0000 +++ b/Xbee/xbeeutils.h Tue Dec 05 19:36:25 2017 +0000 @@ -18,7 +18,8 @@ void discover(); void xbee_init(); void send_data_to_coordinator(char *message, int length); -void test(); +RemoteXBeeZB get_remote_node(); +void xbee_send(const RemoteXBeeZB& xbzb, char * msg, int length); void xbee_broadcast(char *message, int length); void process_rx_frames(); int split (char *str, char c, char ***arr);
