{"id":75,"date":"2026-02-25T20:31:26","date_gmt":"2026-02-25T19:31:26","guid":{"rendered":"https:\/\/elrebo.de\/?p=75"},"modified":"2026-02-25T20:31:29","modified_gmt":"2026-02-25T19:31:29","slug":"onboard_led","status":"publish","type":"post","link":"https:\/\/www.elrebo.de\/index.php\/2026\/02\/25\/onboard_led\/","title":{"rendered":"onboard_led"},"content":{"rendered":"\n<p id=\"block-babce5de-7ee4-410f-8e9c-067f43745c5a\">An ESP-IDF component for <a href=\"https:\/\/elrebo.de\/index.php\/2026\/02\/20\/physical-computing\/\">Physical Computing<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"block-df4b5d1b-8ba5-4bfc-a154-5abbfb8de667\">Purpose<\/h2>\n\n\n\n<p>Functionality to use the onboard LED of ESP32 systems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"block-1b84978f-e613-4a1c-b6c2-a87f746aacca\">How it is done<\/h2>\n\n\n\n<p id=\"block-c76f0c20-d239-47c9-b851-7d15803bcdee\">ESP32  boards normally have an OnBoard LED.<\/p>\n\n\n\n<p id=\"block-c76f0c20-d239-47c9-b851-7d15803bcdee\">Depending on the board this can be a normal LED (e.g. a blue one) or an LED strip, where the color and intensity can be set.<\/p>\n\n\n\n<p id=\"block-c76f0c20-d239-47c9-b851-7d15803bcdee\">Class <code>OnBoardLed<\/code> has two constructors, <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>one for LED type &#8220;GPIO&#8221; (the normal LED) and<\/li>\n\n\n\n<li>one for LED type &#8220;LED strip&#8221;<\/li>\n<\/ul>\n\n\n\n<p>The color and intensity of an LED of type &#8220;LED strip&#8221; can be set with method <code>setLedPixelColor<\/code>.<\/p>\n\n\n\n<p>The LED state (on\/off) can be set with method <code>setLedState<\/code> and retrieved with method <code>getLedState<\/code>.<\/p>\n\n\n\n<p>After setting color, intensity and state the data is transferred to the LED with method <code>show<\/code>.<\/p>\n\n\n\n<p>Method <code>blink<\/code> can be used to let the LED blink.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"block-1f977ab0-a5a8-4276-a88c-829c0aa7bc2a\">Where to find it<\/h2>\n\n\n\n<p id=\"block-a33d75f2-3898-408c-9374-85e442c3d59b\"><code>onboard_led<\/code> is published on the ESP Registry at <a href=\"https:\/\/components.espressif.com\/components\/elrebo-de\/onboard_led\">https:\/\/components.espressif.com\/components\/elrebo-de\/onboard_led<\/a>.<\/p>\n\n\n\n<p id=\"block-30900b77-a005-4353-9218-ed633d42fccc\">The source code can be found at <a href=\"https:\/\/github.com\/elrebo-de\/onboard_led\">https:\/\/github.com\/elrebo-de\/onboard_led<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"block-5fba8ba7-133f-4a5a-a6de-1a9df276e657\">How to use it<\/h2>\n\n\n\n<p id=\"block-47ba9090-bf76-48c4-bbfd-21392955851b\">As an ESP-IDF component <code>onboard_led<\/code> must be included into idf_component.yml as a dependency. As usual this can be done by executing this command:<\/p>\n\n\n\n<p id=\"block-f7e861e7-7e7f-488e-aa55-471e273451f5\"><code>idf.py add-dependency \"elrebo-de\/onboard_led^1.0.6\"<\/code><\/p>\n\n\n\n<p id=\"block-4218ea5a-813e-4892-85c5-12b4d3ebdf87\">In CMakeLists.txt <code>\"elrebo-de__onboard_led\"<\/code> has to be added as a requirement.<\/p>\n\n\n\n<p id=\"block-c5786a76-106e-41bf-a1be-62572719e2f2\">Now you can include <code>onboard_led.hpp<\/code> and use the OnBoardLed class in your program.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An ESP-IDF component for Physical Computing Purpose Functionality to use the onboard LED of ESP32 systems. How it is done ESP32 boards normally have an OnBoard LED. Depending on the board this can be a normal LED (e.g. a blue one) or an LED strip, where the color and intensity can be set. Class OnBoardLed [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":107,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-75","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oss"],"_links":{"self":[{"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/posts\/75","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/comments?post=75"}],"version-history":[{"count":2,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/posts\/75\/revisions"}],"predecessor-version":[{"id":108,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/posts\/75\/revisions\/108"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/media\/107"}],"wp:attachment":[{"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/media?parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/categories?post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elrebo.de\/index.php\/wp-json\/wp\/v2\/tags?post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}