Post your best Lua script examples here

User avatar
By user1829
#23715 anyone have hinys/suggestions as to why i'd be getting negative humidity value?

NodeMCU 0.9.6 build 20150406 powered by Lua 5.1.4
Humidity: -1%
Temperature: 3 deg C
Temperature: 37 deg F
> Humidity: -1%
Temperature: 13 deg C
Temperature: 55 deg F
Humidity: -1%
Temperature: 16 deg C
Temperature: 60 deg F


using the fpmdht.lua and dht.lua scripts...

also just got this:
> PANIC: unprotected error in call to Lua API (error loading module 'dht' from file 'dht.lua':
not enough memory)


(but i might have been trying to run init.lua too much?)

these are my files:

dht.lua : 2410 bytes
init.lua : 3014 bytes
----------------------------
Total file(s) : 2
Total size : 5424 bytes

Total : 52961 bytes
Used : 6275 bytes
Remain: 46686 bytes


???

thanks :)

ps - i'm using ESPlorer v0.2.0-rc2
User avatar
By user1829
#23716 this is what it keeps doing:

> dofile("init.lua")
Humidity: -0.1%
Temperature: 32.5 deg C
Temperature: 90.5 deg F
> PANIC: unprotected error in call to Lua API (error loading module 'dht' from file 'dht.lua':
not enough memory)
PANIC: unprotected error in call to Lua API (attempt to concatenate a nil value)
¨˜{í¡pþ9’)Àø9%‰RÍœÇü

NodeMCU 0.9.6 build 20150406 powered by Lua 5.1.4
Humidity: -0.1%
Temperature: 41.3 deg C
Temperature: 106.34 deg F
> PANIC: unprotected error in call to Lua API (error loading module 'dht' from file 'dht.lua':
not enough memory)
º‰ú


i'm really new to programing/MCUs, so have no idea what "panic" means, or how bad it is???

(it sounds bad!)
User avatar
By TerryE
#24156 Read my FAQ as per below which explains what panics are how you can avoid them