Relay breakout board Library 0.1.0
This is a library for the Relay board with easyC comunication
Loading...
Searching...
No Matches
CH_Relay Class Reference

#include <Relays-SOLDERED.h>

Inherits EasyC.

Public Member Functions

 CH_Relay (int _pin1, int _pin2=-1, int _pin3=-1, int _pin4=-1)
 Sensor specific native constructor for 2 channel board.
 CH_Relay ()
 Constructor for relay control.
void relayControl (int channel, int mode)
 relayControl send two bytes of data to relay to turn it on or off
int getChannelState (int channel)
 getChannelState returns if a relay channel has been turned on or off
Public Member Functions inherited from EasyC
 EasyC ()
 Main constructor for easyC version.
void begin ()
 Initializes sensors on native or easyC on default address.
void begin (uint8_t _address)
 Initializes sensors on supplied i2c address.
int sendAddress (char regAddr)
 Private function to send a single byte to sensor.
int readData (char a[], int n)
 Private function to read n bytes over i2c.
int readRegister (char regAddr, char a[], size_t n)
 Private function to send over i2c and then read n bytes.
int sendData (const uint8_t *a, int n)
 Private function to write n bytes over i2c.

Protected Member Functions

void initializeNative ()
 Overloaded function for virtual in base class to initialize sensor specific.

Private Member Functions

void setChannelState (int channel, int mode)
 setChannelState saves locally the last set state olf a specific relay

Private Attributes

int pin1
int pin2
int pin3
int pin4
int channelState [4] = {0,0,0,0}

Additional Inherited Members

Public Attributes inherited from EasyC
int native = 0
bool beginDone = 0
int err
char address
const char defaultAddress = 0x30

Constructor & Destructor Documentation

◆ CH_Relay() [1/2]

CH_Relay::CH_Relay ( int _pin1,
int _pin2 = -1,
int _pin3 = -1,
int _pin4 = -1 )

Sensor specific native constructor for 2 channel board.

Parameters
int_pin Example parameter.

◆ CH_Relay() [2/2]

CH_Relay::CH_Relay ( )

Constructor for relay control.

Member Function Documentation

◆ getChannelState()

int CH_Relay::getChannelState ( int channel)

getChannelState returns if a relay channel has been turned on or off

Parameters
intchannel
Returns
either HIGH or LOW

◆ initializeNative()

void CH_Relay::initializeNative ( )
protectedvirtual

Overloaded function for virtual in base class to initialize sensor specific.

Implements EasyC.

◆ relayControl()

void CH_Relay::relayControl ( int channel,
int mode )

relayControl send two bytes of data to relay to turn it on or off

Parameters
intchannel sends channel pin to relay
intmode sends HIGH or LOW to relay

◆ setChannelState()

void CH_Relay::setChannelState ( int channel,
int mode )
private

setChannelState saves locally the last set state olf a specific relay

Parameters
intchannel, specific relay channel
intmode either HIGH or LOW

Member Data Documentation

◆ channelState

int CH_Relay::channelState[4] = {0,0,0,0}
private

◆ pin1

int CH_Relay::pin1
private

◆ pin2

int CH_Relay::pin2
private

◆ pin3

int CH_Relay::pin3
private

◆ pin4

int CH_Relay::pin4
private

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