Тёмный

#260 

Ralph S Bacon
Подписаться 54 тыс.
Просмотров 8 тыс.
50% 1

Adding a temperature sensor reading onto a web page, two methods.
► PCBWay $5 for 10 pieces www.pcbway.com
Don't start with this video!
PART 1 shows how to create a landing page on the ESP32 along with OTA (Over The Air, wireless) updates and can be found here • #258 ESP32 Web Pages A... with the code you need too! 😉
And whilst we're on the subject, Part 3 will be available soon which brings it all together and shows the full (and final, improved) ESP32 webpage. But that's for another time. Keep tuned (and subscribed).
All the code and more in my GitHub: bit.ly/GitHub_for_Part2
Still here? OK, let's get some values on screen, whether that be an integer value or a string, both of which I use in my projects. There are, of course, many routes to Rome and I show two of them here. Quick and dirty? Or slick and maintainable? Your choice!
We'll get a value onto the screen (from a pseudo-variable in our ESP32 code) and discuss two ways on how to do that. Finally we'll consider whether what we're doing, that is putting the HTML code into our C++ code is the best way of doing this - or is there another way we could explore (in part 3 perhaps)? Oops, spoiler alert! Too late!
Software
► Rob Tillaart's simple DS18b20 library (for a single DS18b20 per μController pin)
github.com/RobTillaart/DS18B2...
► Pi Hit Waterproof DS18b20
thepihut.com/products/waterpr...
► 5 x DS18b20 eBay Seller umtmedia
www.ebay.co.uk/itm/265498296922
► Pointers in C++
www.cpp.edu/~elab/ECE114/Poin...
► StackOverflow clarification (by others) into pointers & references used in my code
bit.ly/pointerToString
HTML
► W3Schools HTML tutorials
www.w3schools.com/tags/tag_bu...
► Location of Arduino Partition descriptions (.csv files)
C:\Users[Your Name]\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\tools\partitions
NOTE: the ESP32 version (here: 2.0.5) name might be different. Just choose the highest number you have.
Other Stuff
► List of all my videos (Special thanks to Michael Kurt Vogel for compiling this)
bit.ly/RU-vidVideoList-RalphB...
► If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite (and other μControllers) journey
My channel, GitHub and blog are here:
------------------------------------------------------------------
• / ralphbacon
• ralphbacon.blog
• github.com/RalphBacon
• buymeacoffee.com/ralphbacon
------------------------------------------------------------------
My ABOUT page with email address: / ralphbacon

Опубликовано:

 

23 фев 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 102   
@VA7AYG
Really great videos, looking forward to the third part. Thank you Sir!
@Kaczakat
Just use esp websockets, client loads html once, then receive only one (or many) variable from ESP, both ways, JS in html grabs variable from ESP and puts in propriete box in WWW, when user tap some button JS send this action back to ESP. When ESP websocket server has couple client connected (four is about max in ESP) from PC/smartfon/tablet they interact betwen ech other too, when user one tap button ON and see change state on web, rest see that too, immidiently.
@grahamheath3799
Big issue these values will only change by refreshing the page.
@williammiller7543
I've just started using web pages as a way to transfer info to and from my esp(32 & 8266), You have a unique way of teaching these principles and I cannot wait until you get Part 3 out. Thanks for all your video, I've been watching you for several years and enjoy and appreciate each video.
@alexrossouw7702
@alexrossouw7702 Год назад
The esp_async library is filled with tricks and treats to make this process easier, and somewhat beginner friendly too.
@MrDomingo55
@MrDomingo55 Год назад
Beware that there are lots of fake Dallas temp sensors floating around. They may work but perhaps not in 2 wire mode and internal registers may not be fully implemented.
@wdgtmaker
@wdgtmaker Год назад
Easy way to seal stuff is to use glue filled heat shrink. Works just like the regular stuff, but has a thin layer of hot glue between the rubber and whatever you shrunk it onto. It makes the connection effectively weather proof. The only drawback is that the heatshrink is stiff after shrinking. And of course, it is more difficult to remove if you need to. It works excellent for outdoor stuff, or even as tougher protection than regular heatshrink provides.
@GoatZilla
@GoatZilla Год назад
Has Espressif EVER fixed their TCP libraries? I stopped bothering with them a long time ago because they were so incredibly badly broken, and plainly known to be broken. For smallish things they were OK, but if you tried to use them to serve larger content (like a large log of sensor data), they would hang/block/drop constantly.
@davidharms3562
@davidharms3562 Год назад
Great video! Looking forward to part 3 👍🏻
@veedonfleece3694
@veedonfleece3694 Год назад
Thanks for the useful guide, though i did get a bit lost in the depths of the strings & pointers. I need to re-watch whilst awake.
@larsniklassonhede3798
@larsniklassonhede3798 Год назад
Hello again. Nice code but in my IDE 2.0.3 I got this: D:\Documents\Arduino\260_esp32WebPagesOTA\260_esp32WebPagesOTA.ino:104:62: error: 'to_string' was not declared in this scope
@anguspodgorny5436
@anguspodgorny5436 Год назад
Ralph, so glad I (actual name Mark Bussey) found your RU-vid videos a few weeks ago. Great job on them all! I have a question relating to a comment you made in a previous video, but wanted to add my question here so you would see it for sure. You mentioned that several people have said that the String library possibly has memory leaks, and we should stick with std:string instead. What do we do if we're using someone else's library but it uses the String class?
@Bob_Burton
@Bob_Burton Год назад
Why not use sprintf() with the HTML code being in a C style string rather than that clumsy function to find and replace Strings ?
@mainer8912
@mainer8912 Год назад
Good video, thanks.
@gpTeacher
@gpTeacher Год назад
Great content Ralph. I'm looking forward to more OTA tutorials!
@danman32
@danman32 Год назад
I've bought those pre-wired temp sensors. They are waterproof as the actual sensor and wires to it are encapsulated in the metal tube with epoxy.
@alibro7512
@alibro7512 Год назад
A few months ago I asked you about having temperature broadcast on a WIFI page and you kindly replied with a suggestion to do this very thing so I'm really looking forward to future videos.
@kitecattestecke2303
@kitecattestecke2303 Год назад
I will buy an esp32 and follow the videos to learn more!
@electronics.unmessed
@electronics.unmessed Год назад
Again, very good content. That helps me a lot on my way to create better code for my ESP32 projects. Hoping to see more in future. Maybe some graphics?
@johntoe6127
@johntoe6127 Год назад
Nice video Ralph. By the way, the functionality you're trying to program, 'template replacement' is already built in to the AsyncWebServer Library. Templates take the form of %TEMPLATE_NAME% and you define a function called Processor that receives the template, and returns your value. The code looks like this:
Далее
best way out of the labyrinth🌀🗝️🔝
00:17
Просмотров 1,4 млн
Разоблачение ушные свечи
00:28
Просмотров 736 тыс.
#265 Me & My 3D Printer - Just a quick chat!
23:42
Просмотров 7 тыс.
ESP32 Web Server using AJAX
8:03
Просмотров 21 тыс.