wang tang
/
watersensor
LGZD:sensor
Revision 0:1bf4445f640f, committed 2017-10-27
- Comitter:
- e58136782000
- Date:
- Fri Oct 27 08:23:58 2017 +0000
- Commit message:
- watersensor
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 Oct 27 08:23:58 2017 +0000 @@ -0,0 +1,24 @@ +#include "mbed.h" + +DigitalOut ledpin(LED1); +DigitalIn sensor_in(D4); +Serial serial(USBTX, USBRX); +int main(){ + + while(1) { + // LEDs are ON + if(sensor_in) + { + ledpin = 1; + serial.printf("LED:ON\n"); + wait(1.2); + } + else + { + // LEDs are OFF + ledpin = 0; + serial.printf("LED:OFF\n"); + wait(1.4); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Oct 27 08:23:58 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/fb8e0ae1cceb \ No newline at end of file