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

pulse an output for a period of time and than switches off More...

#include <Noiasca_led.h>

Inherits LedBase< T >.

Public Member Functions

 Pulse (T &obj)
 pulse an output for a period of time and than switches of More...
 
void setOnInterval (uint32_t _onInterval)
 set interval times More...
 
void off () override
 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 Pulse< T >

pulse an output for a period of time and than switches off

Turns on a LED for a defined period of time without using the delay() function (monoflop). This means that other code can run at the same time without being interrupted by the LED code. The output acts like a monoflop.

Constructor & Destructor Documentation

◆ Pulse()

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

pulse an output for a period of time and than switches of

Parameters
objthe pin to connect

Member Function Documentation

◆ setOnInterval()

template<class T >
void Pulse< T >::setOnInterval ( uint32_t  _onInterval)
inline

set interval times

Set the on interval of the LED during runtime.

Parameters
_onIntervalthe new on interval

◆ off()

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

switch output off

Switch the output to off state.

◆ update()

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