Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1993 | - | 1 | #include "WProgram.h" |
2 | #include "CommunicationUtils.h" |
||
3 | |||
4 | void serialPrintFloatArr(float * arr, int length) { |
||
5 | for(int i=0; i<length; i++) { |
||
6 | serialFloatPrint(arr[i]); |
||
7 | Serial.print(","); |
||
8 | } |
||
9 | } |
||
10 | |||
11 | |||
12 | void serialFloatPrint(float f) { |
||
13 | byte * b = (byte *) &f; |
||
14 | for(int i=0; i<4; i++) { |
||
15 | |||
16 | byte b1 = (b[i] >> 4) & 0x0f; |
||
17 | byte b2 = (b[i] & 0x0f); |
||
18 | |||
19 | char c1 = (b1 < 10) ? ('0' + b1) : 'A' + b1 - 10; |
||
20 | char c2 = (b2 < 10) ? ('0' + b2) : 'A' + b2 - 10; |
||
21 | |||
22 | Serial.print(c1); |
||
23 | Serial.print(c2); |
||
24 | } |
||
25 | } |