led get stronger

Dependencies:   mbed

Committer:
Kmj
Date:
Wed Jan 27 01:30:42 2016 +0000
Revision:
0:fed6da1bb527
Tihs is new version of st_pwm example. it will works better than previos version.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kmj 0:fed6da1bb527 1 #include "mbed.h"
Kmj 0:fed6da1bb527 2
Kmj 0:fed6da1bb527 3 PwmOut myled(LED1);
Kmj 0:fed6da1bb527 4
Kmj 0:fed6da1bb527 5
Kmj 0:fed6da1bb527 6
Kmj 0:fed6da1bb527 7 int main() {
Kmj 0:fed6da1bb527 8 int i;
Kmj 0:fed6da1bb527 9 myled.period_ms(10);
Kmj 0:fed6da1bb527 10 while(1) {
Kmj 0:fed6da1bb527 11 for(i=1;i<11;i++){
Kmj 0:fed6da1bb527 12 myled.pulsewidth_ms(i);
Kmj 0:fed6da1bb527 13 wait(0.2);
Kmj 0:fed6da1bb527 14 printf("pwm set to %.2f %%\n", myled.read() * 100);
Kmj 0:fed6da1bb527 15 }
Kmj 0:fed6da1bb527 16
Kmj 0:fed6da1bb527 17
Kmj 0:fed6da1bb527 18
Kmj 0:fed6da1bb527 19 }
Kmj 0:fed6da1bb527 20 }