The whole project

Dependencies:   mbed xbee_4180

Committer:
Samer
Date:
Tue Apr 21 19:23:16 2015 +0000
Revision:
0:7474f708bc0c
xxwefrf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Samer 0:7474f708bc0c 1 #include "mbed.h"
Samer 0:7474f708bc0c 2 #include "Zigbee_control.h"
Samer 0:7474f708bc0c 3
Samer 0:7474f708bc0c 4
Samer 0:7474f708bc0c 5
Samer 0:7474f708bc0c 6 float numb = 3.211;
Samer 0:7474f708bc0c 7
Samer 0:7474f708bc0c 8
Samer 0:7474f708bc0c 9 char *float2str( float float_num);
Samer 0:7474f708bc0c 10
Samer 0:7474f708bc0c 11 char c;
Samer 0:7474f708bc0c 12 char *z;
Samer 0:7474f708bc0c 13 int main() {
Samer 0:7474f708bc0c 14
Samer 0:7474f708bc0c 15 // reset the xbees (at least 200ns)
Samer 0:7474f708bc0c 16 //Zigbee_setup();
Samer 0:7474f708bc0c 17
Samer 0:7474f708bc0c 18
Samer 0:7474f708bc0c 19 char* x = float2str(numb);
Samer 0:7474f708bc0c 20 //char x[21];
Samer 0:7474f708bc0c 21 int i=1;
Samer 0:7474f708bc0c 22 while(1) {
Samer 0:7474f708bc0c 23 /*
Samer 0:7474f708bc0c 24 send_Zigbee_string(x);
Samer 0:7474f708bc0c 25 wait_ms(1000);
Samer 0:7474f708bc0c 26 numb = numb*1.1;
Samer 0:7474f708bc0c 27 x = float2str(numb);
Samer 0:7474f708bc0c 28 if(numb>100.0)
Samer 0:7474f708bc0c 29 numb =1.0;
Samer 0:7474f708bc0c 30
Samer 0:7474f708bc0c 31 if(pc.readable())
Samer 0:7474f708bc0c 32 {
Samer 0:7474f708bc0c 33 c = pc.getc();
Samer 0:7474f708bc0c 34 send_Zigbee_char(c);
Samer 0:7474f708bc0c 35 pc.putc(c);
Samer 0:7474f708bc0c 36 }
Samer 0:7474f708bc0c 37 */
Samer 0:7474f708bc0c 38 if(Zigbee_status())
Samer 0:7474f708bc0c 39 {
Samer 0:7474f708bc0c 40
Samer 0:7474f708bc0c 41 z = read_Zigbee_string();
Samer 0:7474f708bc0c 42 // send_Zigbee_string(z);
Samer 0:7474f708bc0c 43 // pc.putc(c);
Samer 0:7474f708bc0c 44 send_Zigbee_string(z);
Samer 0:7474f708bc0c 45 }
Samer 0:7474f708bc0c 46
Samer 0:7474f708bc0c 47
Samer 0:7474f708bc0c 48 }
Samer 0:7474f708bc0c 49 }
Samer 0:7474f708bc0c 50
Samer 0:7474f708bc0c 51 char *float2str( float float_num)
Samer 0:7474f708bc0c 52 {
Samer 0:7474f708bc0c 53 static char retnum[21]; // Enough for 20 digits plus NUL from a 64-bit uint.
Samer 0:7474f708bc0c 54 sprintf( retnum, "%f", float_num );
Samer 0:7474f708bc0c 55 return retnum;
Samer 0:7474f708bc0c 56 }
Samer 0:7474f708bc0c 57