RelayXCR is a simple and lightweight Arduino library for controlling one or more relay modules using digital pins. It supports both active HIGH and active LOW relays, making it flexible for a wide range of relay boards.

- Supports multiple relay instances
- Works with both active HIGH and active LOW logic
- Simple API:
on(),off(),toggle(),isOn() - Lightweight and easy to integrate
#include <RelayXCR.h>RelayXCR relay1(7); // Active HIGH (default)
RelayXCR relay2(8, false); // Active LOWvoid setup() {
relay1.begin();
relay2.begin();
}void loop() {
relay1.on();
delay(1000);
relay1.off();
delay(1000);
relay2.toggle();
delay(1000);
}begin()– Initializes the relay pinon()– Turns the relay onoff()– Turns the relay offtoggle()– Switches the relay stateisOn()– Returnstrueif relay is on,falseotherwise
- Works with any Arduino board
- Tested with HC-SR501 relay modules, Songle relays, and more
MIT License
Created by X-croot Email: unuvarcan111@gmail.com