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

Effect LED. More...

#include <Noiasca_led.h>

Inherits LedBase< T >.

Public Member Functions

void off () override
 switch output off More...
 
void on (bool force=false)
 switch on More...
 
void offForced ()
 ‍** More...
 
brightness_t getCurrentBrightness ()
 get the current brightness More...
 
void setCurrentBrightness (brightness_t brightness)
 set the current brightness More...
 
void setMaxBrightness (brightness_t maxBrightness)
 set the maximum brightness More...
 
void setOnInterval (uint16_t newInterval)
 set on interval More...
 
void setOffInterval (uint16_t newInterval)
 set off interval More...
 
void toggle () override
 switch between on or off state More...
 
void update (uint32_t currentMillis=millis())
 check if update is necessary More...
 
void setInterval (uint16_t _interval0, uint16_t _interval1)
 set on/off times More...
 
void setInterval (uint16_t _interval0, uint16_t _interval1, uint16_t _interval2, uint16_t _interval3)
 set on/off times More...
 
void setInterval (uint16_t _interval0, uint16_t _interval1, uint16_t _interval2, uint16_t _interval3, uint16_t _interval4, uint16_t _interval5)
 set on/off times More...
 
void setInterval (uint16_t _interval0, uint16_t _interval1, uint16_t _interval2, uint16_t _interval3, uint16_t _interval4, uint16_t _interval5, uint16_t _interval6, uint16_t _interval7)
 set on/off times More...
 
void setModeOnOff ()
 activate OnOff mode More...
 
void setModeBlink ()
 activate Blink mode More...
 
void setModeFlicker ()
 activate Flicker mode
 
void setModeFluorescent ()
 activate Fluorescent mode More...
 
void setModeHeartbeat ()
 activate Heartbeat mode More...
 
void setModePulse ()
 activate Pulse mode More...
 
void setModeRhythm ()
 activate Rhythm mode More...
 
void setModeSmooth ()
 activate Smooth mode More...
 
void blink (uint32_t currentMillis)
 "run" function for blink effect More...
 
void flicker (uint32_t currentMillis=millis())
 "run" function for flicker effect More...
 
void fluorescent (uint32_t currentMillis=millis())
 check if update is necessary More...
 
void heartbeat (uint32_t currentMillis=millis())
 check if update is necessary More...
 
void pulse (uint32_t currentMillis=millis())
 check if update for pulse is necessary More...
 
void rhythm (uint32_t currentMillis=millis())
 check if update is necessary More...
 
void smooth (uint32_t currentMillis=millis())
 check if update is necessary More...
 

Detailed Description

template<class T>
class Effect< T >

Effect LED.

A class with different effects for one LED. Uses a unified hw interface

Member Function Documentation

◆ off()

template<class T >
void Effect< T >::off ( )
inlineoverride

switch output off

Switch the effect to off state.

◆ on()

template<class T >
void Effect< T >::on ( bool  force = false)
inline

switch on

If effect is off, switch the output on.

Parameters
forceset to true if new state must be forced to the first ON state. set to false if only the OFF state should be switched ON (default).

◆ offForced()

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

‍**

force switch off

switches off imidiatly without smooth effect

◆ getCurrentBrightness()

template<class T >
brightness_t Effect< T >::getCurrentBrightness ( )
inline

get the current brightness

The current brightness/level of this output

Returns
the current brigthness

◆ setCurrentBrightness()

template<class T >
void Effect< T >::setCurrentBrightness ( brightness_t  brightness)
inline

set the current brightness

The current brightness/level of this output

◆ setMaxBrightness()

template<class T >
void Effect< T >::setMaxBrightness ( brightness_t  maxBrightness)
inline

set the maximum brightness

The output will dimm up to this maximum level.

Parameters
maxBrightnessthe maximum brigthness (upper end of range) [0..255]

◆ setOnInterval()

template<class T >
void Effect< T >::setOnInterval ( uint16_t  newInterval)
inline

set on interval

Set a new interval / time for how long the LED should be on.

Parameters
newIntervalnew interval in milliseconds

◆ setOffInterval()

template<class T >
void Effect< T >::setOffInterval ( uint16_t  newInterval)
inline

set off interval

Set a new interval / time for how long the LED should be off.

Parameters
newIntervalnew interval in milliseconds

◆ toggle()

template<class T >
void Effect< T >::toggle ( )
inlineoverride

switch between on or off state

If the LED is on - switch it off. If the LED is off - switch it on.

◆ update()

template<class T >
void Effect< 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. This run function calls the necessary effect updates

Parameters
currentMillisyou can handover a millis timestamp
Todo:
not all effects are currently supported

◆ setInterval() [1/4]

template<class T >
void Effect< T >::setInterval ( uint16_t  _interval0,
uint16_t  _interval1 
)
inline

set on/off times

Set the on and off interval.

Parameters
_interval0the on interval
_interval1the off interval

◆ setInterval() [2/4]

template<class T >
void Effect< T >::setInterval ( uint16_t  _interval0,
uint16_t  _interval1,
uint16_t  _interval2,
uint16_t  _interval3 
)
inline

set on/off times

Set the on and off interval.

Parameters
_interval0the on interval
_interval1the off interval
_interval2the on interval
_interval3the off interval

◆ setInterval() [3/4]

template<class T >
void Effect< T >::setInterval ( uint16_t  _interval0,
uint16_t  _interval1,
uint16_t  _interval2,
uint16_t  _interval3,
uint16_t  _interval4,
uint16_t  _interval5 
)
inline

set on/off times

Set the on and off interval.

Parameters
_interval0the on interval
_interval1the off interval
_interval2the on interval
_interval3the off interval
_interval4the on interval
_interval5the off interval

◆ setInterval() [4/4]

template<class T >
void Effect< T >::setInterval ( uint16_t  _interval0,
uint16_t  _interval1,
uint16_t  _interval2,
uint16_t  _interval3,
uint16_t  _interval4,
uint16_t  _interval5,
uint16_t  _interval6,
uint16_t  _interval7 
)
inline

set on/off times

Set the on and off interval.

Parameters
_interval0the on interval
_interval1the off interval
_interval2the on interval
_interval3the off interval
_interval4the on interval
_interval5the off interval
_interval6the on interval
_interval7the off interval

◆ setModeOnOff()

template<class T >
void Effect< T >::setModeOnOff ( )
inline

activate OnOff mode

a simple on off output

◆ setModeBlink()

template<class T >
void Effect< T >::setModeBlink ( )
inline

activate Blink mode

sets also the default intervals

◆ setModeFluorescent()

template<class T >
void Effect< T >::setModeFluorescent ( )
inline

activate Fluorescent mode

sets also the default intervals

◆ setModeHeartbeat()

template<class T >
void Effect< T >::setModeHeartbeat ( )
inline

activate Heartbeat mode

sets also the default intervals

◆ setModePulse()

template<class T >
void Effect< T >::setModePulse ( )
inline

activate Pulse mode

sets also the default intervals

◆ setModeRhythm()

template<class T >
void Effect< T >::setModeRhythm ( )
inline

activate Rhythm mode

sets also the default intervals to ECE2.

See also
setInterval

◆ setModeSmooth()

template<class T >
void Effect< T >::setModeSmooth ( )
inline

activate Smooth mode

sets also the default intervals

◆ blink()

template<class T >
void Effect< T >::blink ( uint32_t  currentMillis)
inline

"run" function for blink effect

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

Parameters
currentMillisyou can handover a millis timestamp

◆ flicker()

template<class T >
void Effect< T >::flicker ( uint32_t  currentMillis = millis())
inline

"run" function for flicker effect

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

Parameters
currentMillisyou can handover a millis timestamp

◆ fluorescent()

template<class T >
void Effect< T >::fluorescent ( 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

◆ heartbeat()

template<class T >
void Effect< T >::heartbeat ( 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

◆ pulse()

template<class T >
void Effect< T >::pulse ( uint32_t  currentMillis = millis())
inline

check if update for pulse is necessary

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

Parameters
currentMillisyou can handover a millis timestamp

◆ rhythm()

template<class T >
void Effect< T >::rhythm ( 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

◆ smooth()

template<class T >
void Effect< T >::smooth ( 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