Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Basic RM XBee application complete - 3 sensors with hardcoded address…

…es will print data to the log
  • Loading branch information...
commit f44d0efeb5a037603daf3e078479c54fef120557 1 parent 60bd00f
Andrew Tergis theterg authored
BIN  XBeeAPITest/xbeeapitest/XBeeAPITestApplication$PacketParser.class
Binary file not shown
BIN  XBeeAPITest/xbeeapitest/XBeeAPITestApplication.class
Binary file not shown
11 XBeeAPITest/xbeeapitest/XBeeAPITestApplication.java
@@ -67,11 +67,15 @@ public void processResponse(XBeeResponse res) {
67 67 if (res.getApiId() == ApiId.RX_16_RESPONSE){
68 68 RxResponse pkt = (RxResponse) res;
69 69 String data = ByteUtils.toString(pkt.getData());
  70 + data = data.replaceAll("\n", "");
  71 + data = data.replaceAll("\r", "");
70 72 //dlog("Incoming data "+pkt.getSourceAddress().getAddress()[1]+": "+data);
71 73 if (pkt.getSourceAddress().getAddress()[1] == 1){
72 74 //Data from the Sonar mote
73   - if (data.charAt(0) == 'R'){
74   - ilog("Range: "+data.substring(1)+"(cm)");
  75 + if (data.charAt(0) == 'R'){
  76 + //Remove out-of-range-samples
  77 + if (!data.contains("765"))
  78 + ilog("Range: "+data.substring(1)+" (cm)");
75 79 } else {
76 80 dlog("Sonar data: "+data);
77 81 }
@@ -106,7 +110,8 @@ public void processResponse(XBeeResponse res) {
106 110 //If incoming data is an IO packet
107 111 //Assume this was from a Motion module
108 112 RxResponseIoSample pkt = (RxResponseIoSample) res;
109   - ilog("Motion detected: "+ByteUtils.toBase16(pkt.getSamples()[0].getDioMsb())+","+ByteUtils.toBase16(pkt.getSamples()[0].getDioLsb()));
  113 + //ilog("Motion detected!: "+ByteUtils.toBase16(pkt.getSamples()[0].getDioMsb())+","+ByteUtils.toBase16(pkt.getSamples()[0].getDioLsb()));
  114 + ilog("Motion detected!");
110 115 }
111 116 }
112 117

0 comments on commit f44d0ef

Please sign in to comment.
Something went wrong with that request. Please try again.