IOP / Mbed 2 deprecated Buzzer_HelloWorld_WIZwiki-W7500

Dependencies:   mbed

Committer:
jcm931213
Date:
Wed Apr 19 07:39:43 2017 +0000
Revision:
6:b6113cd596c0
Parent:
5:de0ba139a472
PWM LED control example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jcm931213 6:b6113cd596c0 1
justinkim 0:c4205a3ad6fe 2 #include "mbed.h"
justinkim 0:c4205a3ad6fe 3
justinkim 0:c4205a3ad6fe 4
jcm931213 6:b6113cd596c0 5 PwmOut pwm0(D3);
jcm931213 6:b6113cd596c0 6 PwmOut pwm1(D5);
justinkim 0:c4205a3ad6fe 7
justinkim 0:c4205a3ad6fe 8
justinkim 0:c4205a3ad6fe 9 int main(void)
justinkim 0:c4205a3ad6fe 10 {
justinkim 0:c4205a3ad6fe 11 int i;
justinkim 0:c4205a3ad6fe 12
jcm931213 6:b6113cd596c0 13 while(1){
jcm931213 6:b6113cd596c0 14 for(i=100; i>0; i=i-10) {
jcm931213 6:b6113cd596c0 15 pwm0.write(i*0.01);
jcm931213 6:b6113cd596c0 16 wait(0.05);
jcm931213 6:b6113cd596c0 17 }
jcm931213 6:b6113cd596c0 18
jcm931213 6:b6113cd596c0 19 for(i=100; i>0; i=i-10) {
jcm931213 6:b6113cd596c0 20 pwm1.pulsewidth_ms(i*0.01);
jcm931213 6:b6113cd596c0 21 wait(0.2);
jcm931213 6:b6113cd596c0 22 }
justinkim 0:c4205a3ad6fe 23 }
jcm931213 6:b6113cd596c0 24 }