Line Tracking Sensor (con uscita analogica)
Dependencies: mbed
Revision 0:2279ed878079, committed 2016-11-06
- Comitter:
- Mattinico
- Date:
- Sun Nov 06 19:21:12 2016 +0000
- Commit message:
- k
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 Sun Nov 06 19:21:12 2016 +0000 @@ -0,0 +1,18 @@ +include "mbed.h" +Serial pc(USBTX, USBRX); +DigitalIn TR_sensor(D3); +DigitalOut myled(D2); +AnalogIn Sensor(A1); + +float dist; +int main() { + while(1) { + dist=Sensor.read(); + pc.printf("Distanza = (%f)\r \n",dist); + if (TR_sensor == 0) { + myled = 1; //LED is ON + } else + myled = 0; //LED is OFF + wait(0.5); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Nov 06 19:21:12 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9bcdf88f62b0 \ No newline at end of file