• 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

Learn ESP Course, Module 4, Unit 11 – Asynchronous Web Server: Improper use of graphic symbol in original code

Q&A Forum › Learn ESP Course, Module 4, Unit 11 – Asynchronous Web Server: Improper use of graphic symbol in original code
0 Vote Up Vote Down
Steve Lehr asked 3 years ago
The original code worked fine as advertised, but when I swapped the paragraph blocks, the resulting display was a contorted version of the original.
https://imgur.com/a/JSFV63h
The modified code is linked here:
https://pastebin.com/nDRYvau9
The problem appears to be the use of the percent symbol (%) in the units line of the humidity paragraph block.  This was meant to be used as a graphic symbol to display the units for humidity.  I believe the percent symbol is a special character used to delimit such things as the placeholder definitions and just inserting it between the brackets >%< causes problems downstream when the symbols are later used in the same body block.  Instead, you should use the graphic code for the percent symbol (&#37 or &percent) in the units block.  The following code snippet produces the desired result.
https://pastebin.com/BnFC3VbV
As shown here:
https://imgur.com/a/EaVJwjJ
Any other thoughts on this?
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi Steve.
You are right.
To prevent issues with the % sign, we should use the HTML entity as you said.
We need to change that in the next ebook update.
Thanks for your comment.
Regards,
Sara

0 Vote Up Vote Down
Steve Lehr answered 3 years ago

Having experimented with this projected I learned that the sensor values are only written to the serial monitor when a browser is actively connected to the ESP32 web server.  I suppose that’s because the commands to read the sensors are initiated by the Javacode that has been uploaded to the browser.  This would make asynchronous unsuitable for a system intended to take regular measurements independent of a browser.  

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

Hi Steve.
In that specific example, getting the readings is triggered by the browser. It makes a request to the ESP32, it gets the readings and sends them back to the browser.
If you want to get readings independent of a browser, you need to set up your code in a different way.
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] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

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

Copyright © 2013-2023 · 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.