From 228169cbe57a599a55545dca9d9f9fec0133d9be Mon Sep 17 00:00:00 2001 From: ladyada Date: Sat, 6 Apr 2024 10:27:00 -0400 Subject: [PATCH] add blink --- src/Adafruit_TestBed.cpp | 18 ++++++++++++++++++ src/Adafruit_TestBed.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/Adafruit_TestBed.cpp b/src/Adafruit_TestBed.cpp index 23585e2..9cbedc0 100644 --- a/src/Adafruit_TestBed.cpp +++ b/src/Adafruit_TestBed.cpp @@ -445,6 +445,24 @@ void Adafruit_TestBed::beepNblink(void) { #endif } +/**************************************************************************/ +/*! + @brief light the LED for 500ms, if defined +*/ +/**************************************************************************/ +void Adafruit_TestBed::blink(void) { + if (ledPin >= 0) { + pinMode(ledPin, OUTPUT); + digitalWrite(ledPin, HIGH); + } + + delay(500); + + if (ledPin >= 0) { + digitalWrite(ledPin, LOW); + } +} + //--------------------------------------------------------------------+ // ESP32 Target //--------------------------------------------------------------------+ diff --git a/src/Adafruit_TestBed.h b/src/Adafruit_TestBed.h index 545f98f..0e4be0b 100644 --- a/src/Adafruit_TestBed.h +++ b/src/Adafruit_TestBed.h @@ -59,6 +59,7 @@ class Adafruit_TestBed { void beep(uint32_t freq, uint32_t duration); void beepNblink(void); + void blink(void); uint32_t timestamp(void); void printTimeTaken(bool restamp = false);