Noiasca Tool Kit
Several helper functions and classes to make life with Arduino easier
Public Member Functions | List of all members
Smooth< T > Class Template Reference

dim up / down a LED dimms smoothly More...

#include <Noiasca_led.h>

Inherits LedBase< T >.

Public Member Functions

 Smooth (T &obj)
 dim up / down a LED dimms smoothly More...
 
void offForced ()
 force switch off More...
 
uint16_t getCurrentBrightness ()
 get the current brightness More...
 
void getCurrentBrightness (uint16_t brightness)
 set the current brightness More...
 
void setMaxBrightness (uint16_t newValue)
 set the maximum brightness More...
 
void update (uint32_t currentMillis=millis())
 check if update is necessary More...
 

Detailed Description

template<class T>
class Smooth< T >

dim up / down a LED dimms smoothly

Note
use a PWM pin for a nice effect

Constructor & Destructor Documentation

◆ Smooth()

template<class T >
Smooth< T >::Smooth ( T &  obj)
inline

dim up / down a LED dimms smoothly

Parameters
objthe pin to connect

Member Function Documentation

◆ offForced()

template<class T >
void Smooth< T >::offForced ( )
inline

force switch off

switches off imidiatly without smooth effect

◆ getCurrentBrightness() [1/2]

template<class T >
uint16_t Smooth< T >::getCurrentBrightness ( )
inline

get the current brightness

The current brightness/level of this output

Returns
the current brigthness

◆ getCurrentBrightness() [2/2]

template<class T >
void Smooth< T >::getCurrentBrightness ( uint16_t  brightness)
inline

set the current brightness

The current brightness/level of this output

◆ setMaxBrightness()

template<class T >
void Smooth< T >::setMaxBrightness ( uint16_t  newValue)
inline

set the maximum brightness

The output will dimm up to this maximum level.

Parameters
newValuethe maximum brigthness (upper end of range) [on UNO 0..255]

◆ update()

template<class T >
void Smooth< T >::update ( uint32_t  currentMillis = millis())
inline

check if update is necessary

This is the "run" function. Call this function in loop() to make the effect visible.

Parameters
currentMillisyou can handover a millis timestamp