Left here for archival purposes.

User avatar
By quantalume
#9666 I'm new to Lua, but my understanding is that require() returns an object table. After flashing the latest pre-build (nodemcu_latest.bin), I get the following behaviour:

Code: Select all>PIN = 5 --  data pin, GPIO14
> dht22 = require("dht22")
> dht22.read(PIN)
stdin:1: attempt to index global 'dht22' (a boolean value)
> print(dht22)
true
>


I'm using Javier Yanez' DHT22, but this seems to be true with other Lua modules I've tried. This all worked fine with the 2015-01-27 build. Does this have something to do with node.compile()? I have not compiled any of the modules.

EDIT: I just tried downgrading to nodemcu_20150212.bin, and everything is working as expected again:

Code: Select all> dht22 = require("dht22")
> dht22.read(PIN)
> print(dht22)
table:
>
User avatar
By quantalume
#9768 I think the problem was related to the flash filesystem. When I first upgraded to the 20150213 build, all of the files were still showing up (init.lua and dht22.lua). After upgrading to 20150214, the filesystem appeared to be purged, so I re-uploaded dht22.lua using ESPlorer. It now seems to work fine, even when reverting to 20150213.