ECE 4180 Spring 15
/
4180_Zigbee
The whole project
Diff: main.cpp
- Revision:
- 0:7474f708bc0c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Apr 21 19:23:16 2015 +0000 @@ -0,0 +1,57 @@ +#include "mbed.h" +#include "Zigbee_control.h" + + + +float numb = 3.211; + + +char *float2str( float float_num); + +char c; +char *z; +int main() { + + // reset the xbees (at least 200ns) + //Zigbee_setup(); + + + char* x = float2str(numb); + //char x[21]; + int i=1; + while(1) { + /* + send_Zigbee_string(x); + wait_ms(1000); + numb = numb*1.1; + x = float2str(numb); + if(numb>100.0) + numb =1.0; + + if(pc.readable()) + { + c = pc.getc(); + send_Zigbee_char(c); + pc.putc(c); + } + */ + if(Zigbee_status()) + { + + z = read_Zigbee_string(); + // send_Zigbee_string(z); + // pc.putc(c); + send_Zigbee_string(z); + } + + +} +} + +char *float2str( float float_num) +{ + static char retnum[21]; // Enough for 20 digits plus NUL from a 64-bit uint. + sprintf( retnum, "%f", float_num ); + return retnum; +} +