Led control with wifi connection

AmPalRed
Posts: 1
Joined: Mon Jun 25, 2018 9:40 am

Led control with wifi connection

Postby AmPalRed » Mon Jun 25, 2018 11:34 am

Hi,
I am fairly new to programming in general. I have done very basic arduino programming earlier and currently working with esp idf, which has proven to be very complicated for me in terms of chosing which function we should choose. I wanted connect an LED to esp32 and set it so that when it is trying to connect to wifi, I want to led to blink. I donot want to use any fade option. All I need is a basic blink.
Can any one suggest how do I proceed.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Led control with wifi connection

Postby kolban » Mon Jun 25, 2018 3:33 pm

Since WiFi connection is an asynchronous operation and you get an event callback when it completes, your pseudo code could be something like:

Code: Select all

Request connection to WiFi;
while(WiFi connection not resolved) {
   set Led on;
   sleep(500ms);
   set Led off;
   sleep(500ms);
}
set Led off;
This is less than optimal but it should work.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: No registered users and 117 guests