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.
Dependencies: Chainable_RGB_LED mbed
main.cpp
00001 #include "mbed.h" 00002 #include "ChainableLED.h" 00003 00004 #define NUM_LED 3 00005 00006 // ChainableLED(clk, data, number_of_leds) 00007 ChainableLED color_led(D2, D3, NUM_LED); 00008 00009 int main() 00010 { 00011 uint8_t index = 0; 00012 while(1) { 00013 // generate random RGB values for LED's 00014 uint8_t R = rand(); 00015 uint8_t G = rand(); 00016 uint8_t B = rand(); 00017 // print message to terminal 00018 printf("index = %d, R=%x,G=%x,B=%x,",index,R,G,B); 00019 00020 // ChainableLED.setColorRGB(index_of_led, red, green, blue) 00021 color_led.setColorRGB(index++, R, G, B); // increase brightness cascade down chain of LED's 00022 index = ((index+1) % NUM_LED); // cycle through LED's 00023 wait(0.05); 00024 } 00025 } 00026
Generated on Sat Jul 30 2022 09:31:32 by
