The whole project

Dependencies:   mbed xbee_4180

main.cpp

Committer:
Samer
Date:
2015-04-21
Revision:
0:7474f708bc0c

File content as of revision 0:7474f708bc0c:

#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;
}