RGB LED whitch using PWM signal for the CORE-1000

Dependencies:   mbed

Committer:
odb
Date:
Fri Feb 03 08:01:53 2017 +0000
Revision:
2:b7f2b24f6dac
Parent:
0:4860a91fb495
CORE-1000 First

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:4860a91fb495 1 #include "mbed.h"
bcostm 0:4860a91fb495 2
odb 2:b7f2b24f6dac 3 PwmOut mypwmR(PB_5);
odb 2:b7f2b24f6dac 4 PwmOut mypwmG(PB_3);
odb 2:b7f2b24f6dac 5 PwmOut mypwmB(PA_10);
bcostm 0:4860a91fb495 6
bcostm 0:4860a91fb495 7 DigitalOut myled(LED1);
bcostm 0:4860a91fb495 8
bcostm 0:4860a91fb495 9 int main() {
odb 2:b7f2b24f6dac 10 while(1) {
odb 2:b7f2b24f6dac 11 mypwmR.period_ms(10);
odb 2:b7f2b24f6dac 12 mypwmR.pulsewidth_ms(5);
odb 2:b7f2b24f6dac 13 wait(1);
odb 2:b7f2b24f6dac 14 mypwmR.pulsewidth_ms(0);
bcostm 0:4860a91fb495 15
odb 2:b7f2b24f6dac 16 mypwmG.period_ms(10);
odb 2:b7f2b24f6dac 17 mypwmG.pulsewidth_ms(5);
odb 2:b7f2b24f6dac 18 wait(1);
odb 2:b7f2b24f6dac 19 mypwmG.pulsewidth_ms(0);
bcostm 0:4860a91fb495 20
odb 2:b7f2b24f6dac 21 mypwmB.period_ms(10);
odb 2:b7f2b24f6dac 22 mypwmB.pulsewidth_ms(5);
odb 2:b7f2b24f6dac 23 wait(1);
odb 2:b7f2b24f6dac 24 mypwmB.pulsewidth_ms(0);
odb 2:b7f2b24f6dac 25
odb 2:b7f2b24f6dac 26
odb 2:b7f2b24f6dac 27 // printf("pwm set to %.2f %%\n", mypwmB.read() * 100);
odb 2:b7f2b24f6dac 28
bcostm 0:4860a91fb495 29 }
bcostm 0:4860a91fb495 30 }