Revision 807483bf
ID | 807483bfcb4c1490e8ef4794cf6c19b93211894a |
Fixed range sensor code to support 2
Also, tested (with only one sensor) and it seemed to work adequately.
scout_avr/src/main.cpp | ||
---|---|---|
1 |
#if 0 /////////////////////////////////////////////// |
|
2 |
|
|
1 | 3 |
#include "ros.h" |
2 | 4 |
#include <std_msgs/Int16.h> |
3 | 5 |
|
... | ... | |
30 | 32 |
return 0; |
31 | 33 |
} |
32 | 34 |
|
33 |
/*extern "C" |
|
35 |
#else /////////////////////////////////////////////// |
|
36 |
|
|
37 |
extern "C" |
|
34 | 38 |
{ |
35 | 39 |
#include <stdlib.h> |
36 | 40 |
#include <string.h> |
... | ... | |
42 | 46 |
int main() |
43 | 47 |
{ |
44 | 48 |
char buf[20]; |
45 |
int data; |
|
46 | 49 |
unsigned long now, next = 0; |
47 | 50 |
Atmega128rfa1 avr; |
48 | 51 |
avr.init(); |
... | ... | |
54 | 57 |
next = now + 100; |
55 | 58 |
utoa(range_get(0), buf, 10); |
56 | 59 |
avr.write((uint8_t*) buf, strlen(buf)); |
57 |
/*data = avr.read(); |
|
60 |
avr.write((uint8_t*) ", ", 2); |
|
61 |
utoa(range_get(1), buf, 10); |
|
62 |
avr.write((uint8_t*) buf, strlen(buf)); |
|
63 |
/*int data = avr.read(); |
|
58 | 64 |
if (data >= 0) |
59 | 65 |
{ |
60 | 66 |
uint8_t data8 = data; |
... | ... | |
62 | 68 |
avr.write(&data8, 1); |
63 | 69 |
} |
64 | 70 |
else |
65 |
avr.write((uint8_t*) ".", 1);*//*
|
|
71 |
avr.write((uint8_t*) ".", 1);*/ |
|
66 | 72 |
avr.write((uint8_t*) "\r\n", 2); |
67 | 73 |
} |
68 | 74 |
} |
69 | 75 |
return 0; |
70 | 76 |
} |
71 |
*/ |
|
77 |
|
|
78 |
#endif ////////////////////////////////////////////// |
Also available in: Unified diff