RGB LED whitch using PWM signal for the CORE-1000

Dependencies:   mbed

main.cpp

Committer:
odb
Date:
2017-02-03
Revision:
2:b7f2b24f6dac
Parent:
0:4860a91fb495

File content as of revision 2:b7f2b24f6dac:

#include "mbed.h"

PwmOut mypwmR(PB_5);
PwmOut mypwmG(PB_3);
PwmOut mypwmB(PA_10);

DigitalOut myled(LED1);

int main() {
    while(1) {    
    mypwmR.period_ms(10);
    mypwmR.pulsewidth_ms(5);
    wait(1);
    mypwmR.pulsewidth_ms(0);
    
    mypwmG.period_ms(10);
    mypwmG.pulsewidth_ms(5);
    wait(1);
    mypwmG.pulsewidth_ms(0);
    
    mypwmB.period_ms(10);
    mypwmB.pulsewidth_ms(5);
    wait(1);
    mypwmB.pulsewidth_ms(0);
    

//    printf("pwm set to %.2f %%\n", mypwmB.read() * 100);
    
    }
}