彥隆 鄭
/
LGZDSensor
water sansor 1
main.cpp@0:2b430503298a, 2017-10-27 (annotated)
- Committer:
- paris8022
- Date:
- Fri Oct 27 03:54:15 2017 +0000
- Revision:
- 0:2b430503298a
- Child:
- 1:06e9441a6f01
water sansor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
paris8022 | 0:2b430503298a | 1 | #include "mbed.h" |
paris8022 | 0:2b430503298a | 2 | |
paris8022 | 0:2b430503298a | 3 | PwmOut mypwm(PWM_OUT); |
paris8022 | 0:2b430503298a | 4 | |
paris8022 | 0:2b430503298a | 5 | DigitalOut myled(LED1); |
paris8022 | 0:2b430503298a | 6 | |
paris8022 | 0:2b430503298a | 7 | int main() { |
paris8022 | 0:2b430503298a | 8 | |
paris8022 | 0:2b430503298a | 9 | mypwm.period_ms(10); |
paris8022 | 0:2b430503298a | 10 | mypwm.pulsewidth_ms(1); |
paris8022 | 0:2b430503298a | 11 | |
paris8022 | 0:2b430503298a | 12 | printf("pwm set to %.2f %%\n", mypwm.read() * 100); |
paris8022 | 0:2b430503298a | 13 | |
paris8022 | 0:2b430503298a | 14 | while(1) { |
paris8022 | 0:2b430503298a | 15 | myled = !myled; |
paris8022 | 0:2b430503298a | 16 | wait(1); |
paris8022 | 0:2b430503298a | 17 | } |
paris8022 | 0:2b430503298a | 18 | } |