esp8266 NodeMCU lua html

johndoe71rus
Posts: 1
Joined: Mon Mar 10, 2025 4:43 pm

esp8266 NodeMCU lua html

Postby johndoe71rus » Mon Mar 10, 2025 5:10 pm

Try to update old project esp8266 NodeMCU lua bme280. oddities with the if elseif construct. html code is corrupted.
Old version works on NodeMCU 2.2. New version on 3.0. project based on web-server https://github.com/bondrogeen/web-server

code example

Code: Select all

	<table>
   <thead>
    <tr>
     <th>sensor</th>
     <th><?lua if bmx280.mode == 1 then return("bmp280") elseif bmx280.mode == 2 then return("bme280") else return("no device") end ?></th>
    </tr>
   </thead>
   <tbody>
    <tr>
     <td>temperature</td>
     <td><?lua return(bmx280.temp) ?>&nbspC</td>
    </tr>
    <tr>           
comparison of the source and the code received by the browser in the picture
but if you shorten the " if elseif " then there is no damage

Code: Select all

<th><?lua if bmx280.mode == 1 then return("bmp280") elseif bmx280.mode == 2 then return("bme280") end ?></th>
Attachments
screen-2025-03-10-03-29-11.png
screen-2025-03-10-03-29-11.png (155.27 KiB) Viewed 9093 times

Who is online

Users browsing this forum: No registered users and 1 guest