This is just for bruce!!!

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 PwmOut redpwm(D9);
00004 PwmOut greenpwm(D10);
00005 PwmOut bluepwm(D12);
00006 
00007 int main()
00008 {
00009     int i;
00010     redpwm.period_ms(10);
00011     greenpwm.period_ms(10);
00012     bluepwm.period_ms(10);
00013 
00014 
00015  
00016     while(1) {
00017         for (i=0; i<11; i++) {
00018             redpwm.pulsewidth_ms(i);
00019             printf("redpwm set to %.2f %%\n", redpwm.read() * 100);
00020 
00021             wait(0.1);
00022         }
00023         for (i=0; i<11; i++) {
00024             greenpwm.pulsewidth_ms(i);
00025             printf("greenpwm set to %.2f %%\n", greenpwm.read() * 100);
00026             wait(0.1);
00027         }
00028         for (i=0; i<11; i++) {
00029             bluepwm.pulsewidth_ms(i);
00030             printf("bluepwm set to %.2f %%\n", bluepwm.read() * 100);
00031             wait(0.1);
00032         }
00033     }
00034  
00035 }