asdsdsdsfasf

Dependencies:   mbed

Fork of PwmOut_HelloWorld by Mbed

Committer:
masterhorror
Date:
Thu Mar 19 20:43:49 2015 +0000
Revision:
2:32f6e0cd5d6f
Parent:
1:5160ea45399b
Child:
3:80d90939a6cd
k

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:50d2b9c62765 1 #include "mbed.h"
mbedAustin 1:5160ea45399b 2
mbed_official 0:50d2b9c62765 3 PwmOut led(LED1);
mbedAustin 1:5160ea45399b 4
mbed_official 0:50d2b9c62765 5 int main() {
mbedAustin 1:5160ea45399b 6 // specify period first
masterhorror 2:32f6e0cd5d6f 7 led.period(0.002f); // 4 second period
masterhorror 2:32f6e0cd5d6f 8 led.write(led+0.01f);
masterhorror 2:32f6e0cd5d6f 9 led=led+0.01 // 50% duty cycle, relative to period
mbedAustin 1:5160ea45399b 10 //led = 0.5f; // shorthand for led.write()
mbedAustin 1:5160ea45399b 11 //led.pulsewidth(2); // alternative to led.write, set duty cycle time in seconds
mbedAustin 1:5160ea45399b 12 while(1);
mbed_official 0:50d2b9c62765 13 }