RGB LED whitch using PWM signal for the CORE-1000
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 00003 PwmOut mypwmR(PB_5); 00004 PwmOut mypwmG(PB_3); 00005 PwmOut mypwmB(PA_10); 00006 00007 DigitalOut myled(LED1); 00008 00009 int main() { 00010 while(1) { 00011 mypwmR.period_ms(10); 00012 mypwmR.pulsewidth_ms(5); 00013 wait(1); 00014 mypwmR.pulsewidth_ms(0); 00015 00016 mypwmG.period_ms(10); 00017 mypwmG.pulsewidth_ms(5); 00018 wait(1); 00019 mypwmG.pulsewidth_ms(0); 00020 00021 mypwmB.period_ms(10); 00022 mypwmB.pulsewidth_ms(5); 00023 wait(1); 00024 mypwmB.pulsewidth_ms(0); 00025 00026 00027 // printf("pwm set to %.2f %%\n", mypwmB.read() * 100); 00028 00029 } 00030 }
Generated on Fri Jul 15 2022 02:13:34 by 1.7.2