#include <modm/ui/led/led.hpp>
This class supplies a basic interface to fade an LED to any brightness level. A lookup-table should be used to store the alpha corrected PWM values, so that no calculation has to be done at run time.
Here is an example for the STM32F4: 
#include <modm/ui/led.hpp>
{
});
 
This is just a very, very thin wrapper around modm::ui::Animation<uint8_t>. If you need more advanced features, have a look there.
- See also
 - Animators 
 
- Author
 - Niklas Hauser 
 
 
  
  
      
        
          | void modm::ui::Led::fadeTo  | 
          ( | 
          uint8_t  | 
          brightness,  | 
         
        
           | 
           | 
          uint16_t  | 
          time  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
Fade from the current brightness to a new brightness in the specified ms. Fading times of more than ~32s are not possible. You must control fading externally in that case. 
 
 
  
  
      
        
          | uint8_t modm::ui::Led::getBrightness  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
- Returns
 - brightness of the LED 
 
 
 
  
  
      
        
          | bool modm::ui::Led::isFading  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
- Returns
 true if LED is currently fading to another brightness, false if otherwise 
 
 
  
  
      
        
          | void modm::ui::Led::off  | 
          ( | 
          uint16_t  | 
          time = 120 | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Mimics the behavior of normal lamps, which take a small amount of time until fully extinguished. 
- Parameters
 - 
  
    | time | specify the fade up time in ms, 0 to turn the LED off instantly  | 
  
   
 
 
  
  
      
        
          | void modm::ui::Led::on  | 
          ( | 
          uint16_t  | 
          time = 75 | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Mimics the behavior of normal lamps, which take a small amount of time until achieving full brightness. 
- Parameters
 - 
  
    | time | specify the fade up time in ms, 0 to turn the LED on instantly  | 
  
   
 
 
  
  
      
        
          | void modm::ui::Led::setBrightness  | 
          ( | 
          uint8_t  | 
          brightness | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
- Parameters
 - 
  
    | brightness | between 0 and length of lookup-table (usually 255)  | 
  
   
 
 
  
  
      
        
          | void modm::ui::Led::update  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Can be called at a interval of 1ms or less. If you do not need 1ms response time (e.g. for on(), off()), you may call this at intervals < 255ms. 
 
 
The documentation for this class was generated from the following file: