
test program for IRRangefinder, returns all three possible readings sequentialy.
main.cpp@0:01f84727e31f, 2010-11-25 (annotated)
- Committer:
- littlexc
- Date:
- Thu Nov 25 15:35:45 2010 +0000
- Revision:
- 0:01f84727e31f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
littlexc | 0:01f84727e31f | 1 | #include <mbed.h> |
littlexc | 0:01f84727e31f | 2 | #include <GP2xx.h> |
littlexc | 0:01f84727e31f | 3 | |
littlexc | 0:01f84727e31f | 4 | |
littlexc | 0:01f84727e31f | 5 | Serial pc(USBTX, USBRX); // tx, rx |
littlexc | 0:01f84727e31f | 6 | IRRangeFinder LS(p18,1); |
littlexc | 0:01f84727e31f | 7 | |
littlexc | 0:01f84727e31f | 8 | DigitalOut led1 (LED1); |
littlexc | 0:01f84727e31f | 9 | |
littlexc | 0:01f84727e31f | 10 | int main() { |
littlexc | 0:01f84727e31f | 11 | pc.printf("Hello World!\n"); |
littlexc | 0:01f84727e31f | 12 | while (1) { |
littlexc | 0:01f84727e31f | 13 | led1=!led1; |
littlexc | 0:01f84727e31f | 14 | pc.printf("LS read %d LS read float %F LS read voltage %d\n", LS.read(), LS.read_f(), LS.read_v()); |
littlexc | 0:01f84727e31f | 15 | wait(0.1); |
littlexc | 0:01f84727e31f | 16 | } |
littlexc | 0:01f84727e31f | 17 | } |