Skip to content

Internal LED as status of wifi #20

@joe-ave

Description

@joe-ave

Hello Olli,

I added some stuff in my local version to make the internal pcb mounted LED connected to gpio 2 to show status of the wifi connection, for easier first approach troubleshooting.
Many boards seem to have the internal LED connected to GPIO2, I do not know if all have.
Led off = wifi not connected and ESP still in setup, Led solid on = wifi connected, Led blinking = in AP mode.

//So in the end of the definitions I added:
#define onboard_led 2
bool onboard_led_state = LOW;
unsigned long last_millis = 0;

//In the beginning of setup I added:
pinMode(onboard_led, OUTPUT);

//Outside the loop I created the blink_led_or_not void:
void blink_led_or_not(){
if(wifi_in_setup_mode == true){
if(millis()-last_millis > 500){
onboard_led_state = !onboard_led_state;
digitalWrite(onboard_led, onboard_led_state);
}
}
if(wifi_in_setup_mode == false){
digitalWrite(onboard_led, HIGH);
}
}

//And in the beginning of loop I added:
blink_led_or_not();

//Jonas

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions