Skip to content

Instantly share code, notes, and snippets.

@notdodgy
notdodgy / LedAndRelayTimerWithButton.ino
Created July 25, 2019 22:15
ESP32 code using ticker to check a button press, operate an output for a period and update a flashing status led
#include <Arduino.h>
#include <Ticker.h>
// Define interfaces
#define LED_PIN 26 // --->|--[R]---3v3
#define RELAY_PIN 33
#define BUTTON_PIN 25 // ---./.----0V
// Define Timings
#define LED_ACTIVE_ON 0.2 // Flashing when relay output is active
#define LED_ACTIVE_OFF 0.2 // Time in seconds