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

blink a LED (an output) More...

#include <Noiasca_led.h>

Inherits LedBase< T >.

Public Member Functions

void setOnInterval (uint16_t newInterval)
 set on interval More...
 
void setOffInterval (uint16_t newInterval)
 set off interval More...
 
void off () override
 switch output off More...
 
void on () override
 switch on More...
 
void on (bool force)
 switch on More...
 
void toggle () override
 switch between on or off state More...
 
void update (uint32_t currentMillis=millis())
 check if update is necessary More...
 

Detailed Description

template<class T>
class Blink< T >

blink a LED (an output)

a class to blink a object uses a unified hw interface

Member Function Documentation

◆ setOnInterval()

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

◆ off()

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

switch output off

Switch the effect to off state.

◆ on() [1/2]

template<class T >
void Blink< T >::on ( )
inlineoverride

switch on

If effect is off, switch the output on.

◆ on() [2/2]

template<class T >
void Blink< T >::on ( bool  force)
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).

◆ toggle()

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