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.
led.h
00001 #ifndef CONNECTED_LIGHTS_LED_H_ 00002 #define CONNECTED_LIGHTS_LED_H_ 00003 00004 #if MBED_CONF_APP_LED_TYPE == GROVE_CHAINABLE 00005 #include "ChainableLED.h" // Library to talk to the Grove Chainable LED 00006 static ChainableLED led(MBED_CONF_APP_GROVE_CLOCK_PIN, MBED_CONF_APP_GROVE_DATA_PIN, 1); 00007 #else 00008 static PwmOut redLed(MBED_CONF_APP_LED_PIN_RED); 00009 static PwmOut greenLed(MBED_CONF_APP_LED_PIN_GREEN); 00010 static PwmOut blueLed(MBED_CONF_APP_LED_PIN_BLUE); 00011 #endif 00012 00013 void setRgbColor(float red, float green, float blue) { 00014 #if MBED_CONF_APP_LED_TYPE == GROVE_CHAINABLE 00015 led.setColorRGB(0, static_cast<uint8_t>(red * 255.0f), static_cast<uint8_t>(green * 255.0f), static_cast<uint8_t>(blue * 255.0f)); 00016 #elif MBED_CONF_APP_LED_TYPE == TRICOLOR_ANODE 00017 redLed = 1.0f - red; 00018 greenLed = 1.0f - green; 00019 blueLed = 1.0f - blue; 00020 #else 00021 redLed = red; 00022 greenLed = green; 00023 blueLed = blue; 00024 #endif 00025 } 00026 00027 #endif // CONNECTED_LIGHTS_LED_H_
Generated on Mon Jul 18 2022 13:21:17 by
1.7.2