marvinroger / arduino-sonoff-dual

Arduino library that provides helpers for a custom Sonoff Dual firmware

Repository from Github https://github.commarvinroger/arduino-sonoff-dualRepository from Github https://github.commarvinroger/arduino-sonoff-dual

Arduino Sonoff Dual

Build Status

This Arduino library provides helpers for a custom Sonoff Dual firmware

Features

  • Control the LED
  • Control the relays
  • Detect short press and long press of the hardware button

Installation

  1. Download the latest version
  2. Load the .zip with Sketch → Include Library → Add .ZIP Library

API

See examples folder for examples.

SonoffDualClass ()

Constructor. You don't have to instantiate an instance of the class, use the SonoffDual instance directly.

void .setup ()

Setup the Serial connection, turn the LED off and set both relays off.

SonoffDualButton .handleButton ()

Return SonoffDualButton::NONE if nothing happened, or SonoffDualButton::SHORT or SonoffDualButton::LONG.

void .setLed (bool on)

Set the state of the LED.

  • on: should the LED be on?

bool .setRelays (bool first, bool second)

Set the state of the relays.

  • first: should the first relay be on?
  • second: should the second relay be on?

About

Arduino library that provides helpers for a custom Sonoff Dual firmware

License:MIT License


Languages

Language:C++ 100.0%