Accessories
Arduino for motors and lights library.
AccessoryLight Class Reference

#include "AccessoryLight.hpp"

Inheritance diagram for AccessoryLight:
Accessory

Public Member Functions

 AccessoryLight ()
 
void begin (Port *inpPort, unsigned long inId, unsigned long inBlinkDuration = 0, int inIntensity = 255)
 
void SetBlinking (unsigned long inBlinkingDelay)
 
void SetFading (uint8_t inStep, uint8_t inDelay)
 
bool IsOn () const
 
bool IsBlinking () const
 
bool IsFading () const
 
void Event (unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID, int inData = 0)
 
void SetState (ACC_STATE inState)
 
ACC_STATE Toggle ()
 
void LightOn ()
 
void LightOff ()
 
void Blink ()
 
int EEPROMLoad (int inPos)
 
- Public Member Functions inherited from Accessory
 Accessory ()
 
void begin (ACC_STATE inStartingState = STATE_NONE)
 
PortGetPort () const
 
ACC_STATE GetState () const
 
ACC_STATE GetPreviousState () const
 
bool IsNone () const
 
bool IsFirst () const
 
bool IsSecond () const
 
unsigned int GetDebounceDelay () const
 
unsigned long GetLastMoveTime () const
 
unsigned long GetDuration () const
 
bool loop ()
 
virtual int EEPROMSave (int inPos, bool inSimulate = false)
 
uint8_t AddMovingPosition (unsigned long inId, int inPosition)
 
uint8_t AddMovingPositions (const MovingPosition *inMovingPositions_P)
 
void AdjustMovingPositionsSize (uint8_t inNewSize)
 
bool IsEmpty () const
 
uint8_t IndexOfMovingPositionById (unsigned long inId) const
 
int GetMovingPositionValueById (unsigned long inId) const
 
int GetMovingPositionValueByIndex (uint8_t inIndex) const
 
unsigned long GetMovingPositionIdByIndex (uint8_t inIndex) const
 
const uint8_t GetLastMovingPosition () const
 
const uint8_t GetMovingPositionSize () const
 
void SetLastMovingPosition (uint8_t inLastPositionIndex)
 
void SetDebounceDelay (unsigned int inDebounceDelay)
 
void SetLastMoveTime ()
 
void SetDuration (unsigned long inDuration)
 
void SetNextAccessory (Accessory *inAccessory)
 
Accessory * GetNextAccessory () const
 
unsigned long GetActionStartingMillis () const
 
virtual void StartAction (ACC_STATE inState)
 
bool IsActionDelayPending () const
 
virtual bool IsGroupActionPending () const
 
virtual bool CanBePositional () const
 
virtual void MovePosition (int inPosition)
 
void SetStateRaw (ACC_STATE inNewState)
 
void SetStartingMillis ()
 
void ResetStartingMillis ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Accessory
static void ExecuteEvent (unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID, int inData = 0)
 
static uint8_t GetCount ()
 
static bool IsActionPending ()
 
static Accessory * GetFirstAccessory ()
 
- Protected Attributes inherited from Accessory
PortpPort
 
ACC_STATE prevState
 

Detailed Description

This class describes a single light accessory.

Events handled:

id type dataeffect
light idACCESSORIES_EVENT_MOVEPOSITIONIDtoggle on/off
light id ACCESSORIES_EVENT_TOGGLE toggle on/off
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_STRAIGHT Light on
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_TOP Light on
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_LEFT Light on
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_DIVERGE Light on
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_BOTTOM Light on
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_RIGHT Light on
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_ON Light on
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_STOP Light off
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_OFF Light off
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_MOREIncrease speed of 1
light id ACCESSORIES_EVENT_MOVE ACCESSORIES_MOVE_LESSDecrease speed of 1
light id ACCESSORIES_EVENT_MOVEPOSITION New speed Set the light On at the given speed, without changing the current speed.
light id ACCESSORIES_EVENT_SETSPEED New speed Change the current speed

Definition at line 36 of file AccessoryLight.hpp.

Constructor & Destructor Documentation

AccessoryLight::AccessoryLight ( )

Default constructor.

Definition at line 12 of file AccessoryLight.cpp.

Member Function Documentation

void AccessoryLight::begin ( Port inpPort,
unsigned long  inId,
unsigned long  inBlinkDuration = 0,
int  inIntensity = 255 
)

Initialize the instance.

Parameters
inpPortPort driven this light.
inIdId of this accessory.
inBlinkDurationBlink duration, 0 for fix light. Default is 0.
inIntensityIntensity of this light. Default is maximum, 255.

Definition at line 16 of file AccessoryLight.cpp.

void AccessoryLight::Blink ( )
inline

Turn the light on and blink.

Definition at line 96 of file AccessoryLight.hpp.

int AccessoryLight::EEPROMLoad ( int  inPos)
virtual

Reload all data from the EEPROM.

Remarks
Only for internal usage.

Reimplemented from Accessory.

void AccessoryLight::Event ( unsigned long  inId,
ACCESSORIES_EVENT_TYPE  inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID,
int  inData = 0 
)
virtual

Execute a new event.

Parameters
inIdId of an accessory or an accessory item.
inEventType of the new event. Default is ACCESSORIES_EVENT_MOVEPOSITIONID.
inDataAssociated data to the event type. Default is 0.

Reimplemented from Accessory.

Definition at line 41 of file AccessoryLight.cpp.

bool AccessoryLight::IsBlinking ( ) const
inline

Checks if the light is blinking.

Returns
true if the light is blinking.

Definition at line 69 of file AccessoryLight.hpp.

bool AccessoryLight::IsFading ( ) const
inline

Checks if the light is fading.

Returns
true if the light is fading.
Remarks
A light can dim only with an analog pin.

Definition at line 74 of file AccessoryLight.hpp.

bool AccessoryLight::IsOn ( ) const
inline

Checks if the light is on.

Returns
true if the light is on.

Definition at line 65 of file AccessoryLight.hpp.

void AccessoryLight::LightOff ( )
inline

Turn the light off.

Definition at line 94 of file AccessoryLight.hpp.

void AccessoryLight::LightOn ( )
inline

Turn the light on.

Definition at line 92 of file AccessoryLight.hpp.

void AccessoryLight::SetBlinking ( unsigned long  inBlinkingDelay)
inline

Sets the blinking delay.

Parameters
inBlinkingDelayBlinking delay in milliseconds.

Definition at line 55 of file AccessoryLight.hpp.

void AccessoryLight::SetFading ( uint8_t  inStep,
uint8_t  inDelay 
)
inline

Set the fading mode, defining its speed.

Parameters
inStepNumber of steps between light on and light off.
inDelayDuration of each step.

Definition at line 60 of file AccessoryLight.hpp.

void AccessoryLight::SetState ( ACC_STATE  inState)
inlinevirtual

Sets the internal state.

Parameters
inStatenew state LIGHTON, LIGHTOFF or LIGHTBLINKING.

Reimplemented from Accessory.

Definition at line 86 of file AccessoryLight.hpp.

ACC_STATE AccessoryLight::Toggle ( )
inlinevirtual

Change the state from ON to OFF or OFF to ON.

Returns
The new state.

Implements Accessory.

Definition at line 90 of file AccessoryLight.hpp.


The documentation for this class was generated from the following files: