Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
00001 include "mbed.h" 00002 Serial pc(USBTX, USBRX); 00003 DigitalIn TR_sensor(D3); 00004 DigitalOut myled(D2); 00005 AnalogIn Sensor(A1); 00006 00007 float dist; 00008 int main() { 00009 while(1) { 00010 dist=Sensor.read(); 00011 pc.printf("Distanza = (%f)\r \n",dist); 00012 if (TR_sensor == 0) { 00013 myled = 1; //LED is ON 00014 } else 00015 myled = 0; //LED is OFF 00016 wait(0.5); 00017 } 00018 }
Generated on Thu Jul 21 2022 01:04:20 by
1.7.2