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

turnsignals for a car More...

#include <Noiasca_led.h>

Public Member Functions

 Turnsignal (T &obj)
 car Turn signal More...
 
void begin ()
 start hardware More...
 
void setInterval (uint16_t _on, uint16_t _off)
 set on/off times More...
 
void setOnColor (uint16_t actual, uint32_t _on)
 set on/off color More...
 
void left ()
 left turning signal on More...
 
void right ()
 right turning signal on More...
 
void hazard ()
 hazard turning signal on More...
 
void setOnStateChange (Callback funcPtr)
 set the callback function onStateChange More...
 
void update (uint32_t currentMillis=millis())
 check if update is necessary More...
 

Detailed Description

template<class T>
class Turnsignal< T >

turnsignals for a car

this class needs 3 LEDs (left, right and a hazard warning light in the dashboard).

Constructor & Destructor Documentation

◆ Turnsignal()

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

car Turn signal

This can be used for turning signals on a car. Additionally you can define a hazard indicator on the dashboard which will blink in the rhythm of the turning signals.

Parameters
obja object with 2 or 3 LEDs for turning signals

Member Function Documentation

◆ begin()

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

start hardware

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

◆ setInterval()

template<class T >
void Turnsignal< T >::setInterval ( uint16_t  _on,
uint16_t  _off 
)
inline

set on/off times

Set the on and off interval.

Parameters
_onthe on interval
_offthe off interval

◆ setOnColor()

template<class T >
void Turnsignal< T >::setOnColor ( uint16_t  actual,
uint32_t  _on 
)
inline

set on/off color

Set the on and off colors.

Parameters
actualthe LED number 0 left, 1 right, 2 hazard
_onthe on color

◆ left()

template<class T >
void Turnsignal< T >::left ( )
inline

left turning signal on

Turn on the left signal.

◆ right()

template<class T >
void Turnsignal< T >::right ( )
inline

right turning signal on

Turn on the right signal.

◆ hazard()

template<class T >
void Turnsignal< T >::hazard ( )
inline

hazard turning signal on

will activate left and right turning signal and the hazarad light in the dashboard (if defined).

◆ setOnStateChange()

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

set the callback function onStateChange

a callback function receives state changes from the effect

Parameters
funcPtrthe callback function

◆ update()

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