-
Notifications
You must be signed in to change notification settings - Fork 0
DS_CAP_SYS_LED
This capability adds support for an on-board LED. The following fields are implemented:
Field | Description | Default Value |
---|---|---|
JLed System::led |
Builtin LED | LED_BUILTIN |
LED pin is determined by LED_BUILTIN
macro, which is normally set up automatically with the board selection in Arduino. If you are using a Generic ESP8266 Module
, be sure to select the right pin via Tools
-> Builtin Led
Arduino menu (it is 1
for ESP-01 and 2
for ESP-01S).
The actual LED functionality is implemented with JLed library. DS-System library exposes led
object which gives full access to JLed methods.
- JLed — LED support library
-
DS_CAP_SYS_NETWORK — if network is enabled in presence of LED capability, its
System::connectNetwork()
will change signature to take an optional LED object. If passed, it will be used to signal Wi-Fi connection progress; - DS_CAP_WIFIMANAGER — if Wi-Fi manager is enabled, the LED will be lit steadily while Wi-Fi manager is running.
-
DS_CAP_SYS_LOG_HW — in some boards, like ESP-01, the on-board LED is controlled by a serial TX pin. This means that, if both LED and syslog capabilities are enabled, a conflict over pin control may happen. Both features will likely misbehave in this case. To decrease such possibility, library will issue a compilation warning:
#warning "In ESP8266, capabilities DS_CAP_SYS_LED and DS_CAP_SYS_LOG_HW may conflict on a pin. Define DS_LED_VS_SERIAL_CHECKED_OK to suppress this warning"
In many cases, serial TX and on-board LED will use different pins. It is also possible to reallocate serial TX pin at runtime (the on-board LED is soldered to the pin and cannot be altered). The library has no means to detect if there would be actually a conflict in your case or not. If you are sure that there is no conflict, define
DS_LED_VS_SERIAL_CHECKED_OK
inMySystem.h
in order to suppress the compilation warning.
MySystem.h
:
#define DS_CAP_SYS_LED // Enable builtin LED
#include "System.h" // System global definitions
sketch.ino
:
#include "MySystem.h"
using namespace ds;
void setup() {
System::begin();
System::led.Blink(1000, 2000).Forever();
}
void loop() {
System::update();
}
System::begin() |
Required |
System::update() |
Required |
Certain LED states, such as fully "on" or fully "off", do not warrant use of System::update()
. Some other, such as glowing effect, require System::update()
to be called with little-to-no delay. See JLed documentation for details.
None.
Version 1.0 or later.
None.
- DS_CAP_APP_ID
- DS_CAP_APP_LOG
- DS_CAP_BUTTON
- DS_CAP_MDNS
- DS_CAP_SYS_FS
- DS_CAP_SYS_LED
- DS_CAP_SYS_LOG
- DS_CAP_SYS_LOG_HW
- DS_CAP_SYS_NETWORK
- DS_CAP_SYS_RESET
- DS_CAP_SYS_RTCMEM
- DS_CAP_SYS_TIME
- DS_CAP_SYS_UPTIME
- DS_CAP_TIMERS
- DS_CAP_TIMERS_ABS
- DS_CAP_TIMERS_COUNT_ABS
- DS_CAP_TIMERS_COUNT_TICK
- DS_CAP_TIMERS_SOLAR
- DS_CAP_WEB_TIMERS
- DS_CAP_WEBSERVER
- DS_CAP_WIFIMANAGER