Coder Social home page Coder Social logo

relaymodule's Introduction

Relay Module Library

For Arduino boards.

The Library implements a set of methods for working with a digital relay module.

Relay modules are assembled units commonly included with Optocouplers, diodes, LED’s, transistors, etc.. So, for the Arduino interfacing we just have to connect a supply voltage, GND and input signal connection.

Installation

  1. Download the Latest release from gitHub.
  2. Unzip and modify the Folder name to "RelayModule" (Remove the '-version')
  3. Paste the modified folder on your Library folder (On your libraries folder inside Sketchbooks or Arduino software).
  4. Restart the Arduino IDE.

Circuit Diagram

An input section of the relay module consists of three terminals VCC and GND and a signal input (IN).

Circuit Diagram

If the load connection is between the COM and NC, the terminals will be closed for LOW state input signal and open during HIGH state input. Inversely, the HIGH state closes and LOW state opens for a connection between COM and NO.The output contacts of the module have three connections, labelled as Common (COM), Normal close (NC) and Normal open (NO).

Methods

    // Instantiation:
	/**
		DIGITAL_PIN - a digital port pin that
		is attached to the relay.
	*/
	RelayModule relay(DIGITAL_PIN);

    // or
	/**
		If you need to invert a sensor signal:
		INVERT_SIGNAL:
			true - invert a signal;
			false - not invert a signal.
	*/
	RelayModule relay(DIGITAL_PIN, INVERT_SIGNAL);

	// Turns ON the relay if it is off.
	relay.on();

	// Turns OFF the relay if it is on.
	relay.off();

	/**
		Checks if the relay is ON.
		Return true if the relay is on,
		false if the relay is off.
	*/
	relay.isOn();

	/**
		Checks if the relay is OFF.
		Return true if the relay is off,
		false if the relay is on.
	*/
	relay.isOff();

See examples...

Created by Yurii Salimov.

relaymodule's People

Contributors

suoapvs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

relaymodule's Issues

setState(const status)

I think it could be helpful to have a switch-Method using boolean parameter. Something like:

void RelayModule::setState(const boolean flag) {
   write((flag ? this->onSignal : this->offSignal );
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.