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: mbed BME280 SI1145
Diff: main.cpp
- Revision:
- 7:6ee530637c90
- Parent:
- 6:4b1ecb3a95c5
- Child:
- 8:1703f45edfa2
--- a/main.cpp Wed Jul 05 21:24:02 2017 +0000
+++ b/main.cpp Wed Jul 05 23:58:11 2017 +0000
@@ -63,8 +63,8 @@
//MotionDetect.rise(&PIR);
char pc_data = 'e';
- char buffer[6];
-
+ char buffer[5];
+
int temp = 1;
int pressure = 2;
int humidity = 3;
@@ -95,6 +95,7 @@
//Read in data from XBee
+ /*
if(xb.readable()){
wait(0.01);
xb.gets(buffer, 6);
@@ -103,16 +104,22 @@
if((buffer[4] == nodeID) || (buffer[3] == nodeID) || (buffer[2] == nodeID) || (buffer[1] == nodeID)){
send_enable = true;
}
-
- pc.printf("test after check");
-
- // TODO: CODE WORKS IF WE SEND IT '1111', BUT NOT IF WE SEND 'ID:1'
- // TODO: unf*** the code
- /*
- if((buffer[3] == nodeID)){
+ memset(buffer, '\0', sizeof(buffer));
+ }*/
+
+
+ // testing out using getc() instead of gets()
+ if(xb.readable()){
+ wait(0.01);
+ for(int i = 0; i < 5; i++){
+ buffer[i] = xb.getc();
+ pc.printf("%c",buffer[i]);
+ }
+
+ pc.printf("\r\n");
+ if((buffer[4] == nodeID)){
send_enable = true;
- }*/
-
+ }
memset(buffer, '\0', sizeof(buffer));
}