David Buck
/
car_dist_sens
Revision 0:5e45a0e565af, committed 2010-02-12
- Comitter:
- Kaikestu
- Date:
- Fri Feb 12 12:55:58 2010 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Feb 12 12:55:58 2010 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" +#include "SRF05.h" + +DigitalOut myled(LED1); +SRF05 front (p24,p23); +Serial pc(USBTX, USBRX); + +float dist; + +int main() { + while (1) { + dist = front.read(); + if (dist < 10) { + myled =1; + } + else { + myled=0; + } + pc.printf("%.2f\n", dist); + + wait(0.5); + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Feb 12 12:55:58 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0