nanoI2CSlaveExpander
ARDUINO Nano v3 used as I2C slace digital and analog io expander for ESP8266 and others...
CFlasherNanoExp Class Reference

a Class to flash a LED through nanoI2CIOExpander... More...

#include <nanoI2CIOExpLib.h>

Public Member Functions

 CFlasherNanoExp ()
 
 CFlasherNanoExp (int compAdd)
 
void begin (int pin, unsigned long ton, unsigned long toff)
 to prepare Led Flashing... More...
 
void begin (int pin, unsigned long ton, unsigned long toff, int repeat, unsigned long period)
 Method to start flasher in repeat mode... More...
 
void update ()
 This function should be call periodicly. More...
 
void reverseMode ()
 Reverse the mode when it should be off it is on and conversely. More...
 
int getChangeStateCpt ()
 to stop flashing after a certain number of times More...
 
void stop ()
 this function stop LED More...
 
void high ()
 to put led allways at ON state More...
 
void low ()
 to put led allways at OFF state More...
 

Detailed Description

a Class to flash a LED through nanoI2CIOExpander...

This class is for flashing led with no delay function call with diffrents ton and toff

In setup or elsewhere create a Flasher instance i and call i.begin( pin, ton, toff )

Or begin( pin, ton, toff, repeat, period ) to flash n time in the period.

reverseMode() can be used to inverse on and off times.

They are no default values.

In a loop call i.update();

To return to led off and stop flashing you can call i.stop()

i.getChangeStateCpt() can be used to flash a certain number of times

to put LEd allways on or off call i.high() and i.low() method

Definition at line 77 of file nanoI2CIOExpLib.h.

Constructor & Destructor Documentation

◆ CFlasherNanoExp() [1/2]

CFlasherNanoExp::CFlasherNanoExp ( )
inline

Definition at line 79 of file nanoI2CIOExpLib.h.

◆ CFlasherNanoExp() [2/2]

CFlasherNanoExp::CFlasherNanoExp ( int  compAdd)
inline

Definition at line 80 of file nanoI2CIOExpLib.h.

Member Function Documentation

◆ begin() [1/2]

void CFlasherNanoExp::begin ( int  pin,
unsigned long  ton,
unsigned long  toff 
)

to prepare Led Flashing...

Parameters
pinthe pin number where the LED is connected (anode connection and cathod to ground) 0 to 7
tontime during the LED is switched on in milliseconds
tofftime during the LED is switched off in milliseconds
Returns
no return value This function puts pin in output mode and write it to 0 (low state ie off)

Definition at line 190 of file nanoI2CIOExpLib.cpp.

◆ begin() [2/2]

void CFlasherNanoExp::begin ( int  pin,
unsigned long  ton,
unsigned long  toff,
int  repeat,
unsigned long  period 
)

Method to start flasher in repeat mode...

Parameters
pinsame as in the normal implementation of begin
tonsame as in the normal implementation of begin
toffsame as in the normal implementation of begin
repeatnumber of repetitions
periodtotal period
Returns
nothing

period shall be greter then repeat*( ton + toff )

and repeat shall be greater than 1

Definition at line 223 of file nanoI2CIOExpLib.cpp.

◆ getChangeStateCpt()

int CFlasherNanoExp::getChangeStateCpt ( )
inline

to stop flashing after a certain number of times

Definition at line 85 of file nanoI2CIOExpLib.h.

◆ high()

void CFlasherNanoExp::high ( )

to put led allways at ON state

Returns
no return value and no parameter

Definition at line 323 of file nanoI2CIOExpLib.cpp.

◆ low()

void CFlasherNanoExp::low ( )

to put led allways at OFF state

Returns
no return value and no parameter

Definition at line 334 of file nanoI2CIOExpLib.cpp.

◆ reverseMode()

void CFlasherNanoExp::reverseMode ( )

Reverse the mode when it should be off it is on and conversely.

Returns
no return value and no parameter

A second call return to normal state

Definition at line 310 of file nanoI2CIOExpLib.cpp.

◆ stop()

void CFlasherNanoExp::stop ( )

this function stop LED

Returns
no param and no return value

Warning this function doesn't no prevent update() to work (except that the pin is in input mode)

Definition at line 288 of file nanoI2CIOExpLib.cpp.

◆ update()

void CFlasherNanoExp::update ( )

This function should be call periodicly.

Returns
no param and no return value

Function check time with millis function and switch LED if necessary

Definition at line 242 of file nanoI2CIOExpLib.cpp.


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