Post your best Lua script examples here

User avatar
By Toshi Bass
#11058 Thank you for your responce, I will perhaps give 0.9.4 a go but I already went back to the working 0.9.2 code, I completly agree with you regarding ESP and Lua is so dam frustrating it goes from bad to worse with each new release, i am so ready to take a different route, Lua seams a dead end.
User avatar
By mikebetz
#14986 Thanks so much to Pig and others for the code and discussion.

In case this helps someone else ...

I recently got an ESP-07, and used NodeMCU 0.9.5 build 20150318 on it.

I could not read from my DHT11 (always got results of 0 for data and checksum) until I changed the threshold to >1 instead of >2 (I simply never saw a 3 or greater in the bitstream array, just 0 or 1 or 2.)

-- original code 0.9.4 limit is 2
hiLimit = 1

for i = 1, 8, 1 do
if (bitStream[i+0] > hiLimit) then
Humidity = Humidity+2^(8-i)
end
end

(I changed the other FOR loops as well, of course)

With that change ... I was able to read temp & humidity.

Thanks again.