ECE 4180 Spring 15 / Mbed 2 deprecated 4180_Zigbee

Dependencies:   mbed xbee_4180

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "Zigbee_control.h"
00003 
00004 
00005 
00006 float numb = 3.211;        
00007 
00008 
00009 char *float2str( float float_num);
00010 
00011 char c;
00012 char *z;
00013 int main() {
00014 
00015     // reset the xbees (at least 200ns)
00016     //Zigbee_setup();
00017     
00018     
00019     char* x = float2str(numb);
00020     //char x[21];
00021     int i=1;
00022     while(1) {
00023      /*  
00024     send_Zigbee_string(x);
00025     wait_ms(1000);
00026     numb = numb*1.1;
00027     x = float2str(numb);
00028     if(numb>100.0)
00029         numb =1.0;
00030     
00031     if(pc.readable())
00032     {
00033         c = pc.getc();
00034         send_Zigbee_char(c);
00035         pc.putc(c);    
00036     }
00037     */
00038     if(Zigbee_status())
00039     {
00040       
00041       z = read_Zigbee_string();
00042      // send_Zigbee_string(z);
00043    // pc.putc(c);
00044     send_Zigbee_string(z);
00045     }
00046     
00047     
00048 }
00049 }
00050 
00051 char *float2str( float float_num)
00052 {
00053     static char retnum[21];       // Enough for 20 digits plus NUL from a 64-bit uint.
00054     sprintf( retnum, "%f", float_num );
00055     return retnum;
00056 }
00057