Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 00003 PwmOut r (LED1); 00004 PwmOut g (LED2); 00005 PwmOut b (LED3); 00006 00007 00008 float RGB_Colour[3]; 00009 00010 00011 int main() 00012 { 00013 r.period(0.001); 00014 00015 00016 while(1) { 00017 00018 00019 RGB_Colour[0] = 1.0; // start with red 00020 RGB_Colour[1] = 0.0; 00021 RGB_Colour[2] = 0.0; 00022 00023 for (int DEC_Colour = 0; DEC_Colour < 3; DEC_Colour += 1) { 00024 int INC_Colour = DEC_Colour == 2 ? 0 : DEC_Colour + 1; 00025 00026 // cross-fade the two colors. 00027 for(float i = 0.0; i < 1.0 ; i += 0.001) { 00028 RGB_Colour[DEC_Colour] -= 0.001; 00029 RGB_Colour[INC_Colour] += 0.001; 00030 00031 r = 1.0-RGB_Colour[0]; 00032 g = 1.0-RGB_Colour[1]; 00033 b = 1.0-RGB_Colour[2]; 00034 00035 wait(0.001); 00036 } 00037 } 00038 } 00039 00040 }
Generated on Wed Jul 13 2022 09:25:58 by
1.7.2