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

alternate blinking of to LEDs in a specific rhythm More...

#include <Noiasca_led.h>

Public Member Functions

void begin ()
 start hardware More...
 
void setOnInterval (uint16_t onA, uint16_t onB)
 set on/off times More...
 
void setOnInterval (uint16_t onA)
 set on/off times More...
 
void setOnStateChange (Callback funcPtr)
 set the callback function onStateChange More...
 
void on ()
 switch output on More...
 
void off ()
 switch output off More...
 
void toggle ()
 switch between on or off state
 
void update (uint32_t currentMillis=millis())
 check if update is necessary More...
 

Detailed Description

template<class T>
class Alternating< T >

alternate blinking of to LEDs in a specific rhythm

two LEDs blinking alternating

doesn't inherit from LedBase.

Member Function Documentation

◆ begin()

template<class T >
void Alternating< T >::begin ( )
inline

start hardware

Will do the necessary steps to initialize the hardware pins. Call this function in your setup().

◆ setOnInterval() [1/2]

template<class T >
void Alternating< T >::setOnInterval ( uint16_t  onA,
uint16_t  onB 
)
inline

set on/off times

Set the on intervals of both LEDs during runtime.

Parameters
onAthe on time of pinA in ms (vice versa the off time of pinB).
onBthe on time of pinB in ms (vice versa the off time of pinB).

◆ setOnInterval() [2/2]

template<class T >
void Alternating< T >::setOnInterval ( uint16_t  onA)
inline

set on/off times

Set the interval during runtime.

Parameters
onAthe on time of pinA and pinB in ms.

◆ setOnStateChange()

template<class T >
void Alternating< T >::setOnStateChange ( Callback  funcPtr)
inline

set the callback function onStateChange

a callback function receives state changes from the effect

Parameters
funcPtrthe callback function

◆ on()

template<class T >
void Alternating< T >::on ( )
inline

switch output on

Switch the output to on state.

◆ off()

template<class T >
void Alternating< T >::off ( )
inline

switch output off

Switch the output to off state.

◆ update()

template<class T >
void Alternating< 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