Dependencies: mbed
Fork of PwmOut_HelloWorld by
Diff: main.cpp
- Revision:
- 2:892363315d18
- Parent:
- 1:5160ea45399b
--- a/main.cpp Sun Sep 21 06:39:30 2014 +0000 +++ b/main.cpp Fri Oct 07 03:55:02 2016 +0000 @@ -1,12 +1,15 @@ #include "mbed.h" -PwmOut led(LED1); +PwmOut led(D5); +//DigitalOut led(led); int main() { // specify period first - led.period(4.0f); // 4 second period - led.write(0.50f); // 50% duty cycle, relative to period + led.period(0.01f); // 4 second period + led.write(0.150f); // 50% duty cycle, relative to period //led = 0.5f; // shorthand for led.write() //led.pulsewidth(2); // alternative to led.write, set duty cycle time in seconds - while(1); + while(1){ + printf("%f\n",led.read()); + } } \ No newline at end of file