Easyuino  1.2.0
Easyuino::Relay Class Reference

Relay offers a simple API to interact with relay devices. More...

#include <Relay.h>

Inheritance diagram for Easyuino::Relay:
Easyuino::Device Easyuino::RelayNamed

Public Member Functions

 Relay (IN uint8_t arduinoPin)
 Constructor. More...
 
 ~Relay ()
 Destructor.
 
bool begin ()
 Used to put the device ready to receive requests. More...
 
bool begin (IN bool isNormallyClosed, IN uint8_t normallyClosedPinLevel)
 Used to initialize the relay API depending on how the relay will be connected. More...
 
void end ()
 Used to stop the device API. More...
 
void turnOn ()
 Turns on the device that is connected to the relay (depends on how the begin(bool,uint8_t) was called)
 
void turnOff ()
 Turns off the device that is connected to the relay (depends on how the begin(bool,uint8_t) was called)
 
bool isOn () const
 
- Public Member Functions inherited from Easyuino::Device
 Device ()
 Constructor called by every sub-classes.
 
 ~Device ()
 Destroy all the resources associated with the device.
 
bool isInitialized () const
 Verify is the device is initialized and ready to use. More...
 

Additional Inherited Members

- Protected Attributes inherited from Easyuino::Device
bool _isInitialized
 Used to know if the device API is initialized and ready to receive requests.
 

Detailed Description

Relay offers a simple API to interact with relay devices.

See also
Devices Supported: SRD-05VDC-SL-C, Probably any relay because they are very simple devices
Devices Tested: SRD-05VDC-SL-C

Constructor & Destructor Documentation

◆ Relay()

Easyuino::Relay::Relay ( IN uint8_t  arduinoPin)

Constructor.

Parameters
arduinoPinArduino pin that is connected with the relay (normaly called IN pins in the relay boards)

Member Function Documentation

◆ begin() [1/2]

bool Easyuino::Relay::begin ( )
virtual

Used to put the device ready to receive requests.

Normally this have some default behaviour some devices have other overload method with same name that receives other arguments to device customization.

Returns
True: If the device was initialized. False: Otherwise.

Implements Easyuino::Device.

◆ begin() [2/2]

bool Easyuino::Relay::begin ( IN bool  isNormallyClosed,
IN uint8_t  normallyClosedPinLevel 
)

Used to initialize the relay API depending on how the relay will be connected.

Parameters
isNormallyClosedDefine what are the state that relay is powering the device (lamp, engine, etc) Normally Closed or Normally Open
normallyClosedPinLevelDigital level of the normally closed relay state (some relays activate on HIGH other on LOW)

◆ end()

void Easyuino::Relay::end ( )
virtual

Used to stop the device API.

After this the the device will not process API requests.

Implements Easyuino::Device.

◆ isOn()

bool Easyuino::Relay::isOn ( ) const
Returns
isON True: If it is in open state. False: Otherwise.

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