• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Going ahead if not Wi-Fi connection available

Q&A Forum › Category: ESP32 › Going ahead if not Wi-Fi connection available
0 Vote Up Vote Down
Paul asked 6 years ago

Hi there, I need some help. I´m using an ESP32 and in my code I connect to the Wi-Fi with the classic “while” statement:

while (wifiMulti.run() != WL_CONNECTED) {
delay(250);
}

In my case even that the Wi-Fi connection is necessary it is not essential and the code needs to go ahead with the rest of lines, unfortunately it stops while it’s not able to find a such connection available. I’ll really appreciate if someone helps me how to modify my code for:

  • to try to connect to Wi-Fi
  • and if is not possible going ahead with the rest of the code.

Thanks in advance

2 Answers
0 Vote Up Vote Down
Paul answered 6 years ago

Deva_Rishi from Arduino forum helped me already. It was very simple. If someone is interested this is the code correction:

uint32_t starttime=millis();

while ((wifiMulti.run() != WL_CONNECTED) && (millis()-starttime>TIME_OUT)) {

delay(250);

}

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Hello Paul, I’m glad you were able to find an answer and make it work! Thanks for posting the solution. I’ll mark this thread as “Resolved”.
Regards,
Rui

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.