https://github.com/marvinroger/arduino-sonoff-dual
Arduino library that provides helpers for a custom Sonoff Dual firmware
https://github.com/marvinroger/arduino-sonoff-dual
arduino arduino-library esp8266 esp8266-arduino sonoff sonoff-dual
Last synced: 7 months ago
JSON representation
Arduino library that provides helpers for a custom Sonoff Dual firmware
- Host: GitHub
- URL: https://github.com/marvinroger/arduino-sonoff-dual
- Owner: marvinroger
- License: mit
- Created: 2017-03-21T19:09:13.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-02T19:28:49.000Z (over 7 years ago)
- Last Synced: 2025-03-16T14:47:56.650Z (7 months ago)
- Topics: arduino, arduino-library, esp8266, esp8266-arduino, sonoff, sonoff-dual
- Language: C++
- Homepage:
- Size: 4.88 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Arduino Sonoff Dual
[](https://travis-ci.org/marvinroger/arduino-sonoff-dual)
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](https://github.com/marvinroger/arduino-sonoff-dual/archive/master.zip)
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?