• 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

Build an ESP32 Web Server using Files from Filesystem (SPIFFS) – Module 13 Unit 4

Q&A Forum › Category: ESP32 › Build an ESP32 Web Server using Files from Filesystem (SPIFFS) – Module 13 Unit 4
0 Vote Up Vote Down
KARL WATTS asked 5 years ago

Sara Hi, Regarding the Arduino Sketch. Most of the code is written within the void setup() function. I was always taught that setup() runs only once. How then does the ESP32 react to redirects /on and /off as the coding sits within function setup()?
Regards
KARL
P.S. Really nice unit, learned alto!!

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi Karl.

In that unit, we are building an asynchronous web server. We define what will happen when some event occurs.
Basically, when you use the on() methods on the server, it means that the server (the ESP32) will be listening for requests on the URL we define.
When a request arrives on a URL we have defined, the ESP32 will run whatever we write for that particular request.

Do you know how interrupts work with the ESP32? When the interrupt happens we call a callback function that will be executed. And we don’t need to put anything on the loop(). It is similar here, basically, those lines mean “when this happens, do this”.

Let me know if this is clear.
Regards,
Sara

0 Vote Up Vote Down
KARL WATTS answered 5 years ago

Sara, Thanks! You can mark this one as resolved! ☺

0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Great!
If you need further help, you just need to open a new question in our forum.
Regards,
Sara

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

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition 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.