彥隆 鄭
/
LGZDSensor
water sansor 1
Diff: main.cpp
- Revision:
- 1:06e9441a6f01
- Parent:
- 0:2b430503298a
diff -r 2b430503298a -r 06e9441a6f01 main.cpp --- a/main.cpp Fri Oct 27 03:54:15 2017 +0000 +++ b/main.cpp Fri Oct 27 07:27:57 2017 +0000 @@ -1,18 +1,18 @@ #include "mbed.h" -PwmOut mypwm(PWM_OUT); +DigitalOut ledpin(LED1); +DigitalIn sensor_in(D7); -DigitalOut myled(LED1); + -int main() { - - mypwm.period_ms(10); - mypwm.pulsewidth_ms(1); - - printf("pwm set to %.2f %%\n", mypwm.read() * 100); - +int main(){ + while(1) { - myled = !myled; - wait(1); - } -} + // LEDs are ON + ledpin = 1; + wait(1.2); + // LEDs are OFF + ledpin = 0; + wait(1.4); + } +} \ No newline at end of file