Current Lua downloadable firmware will be posted here

User avatar
By picstart1
#2947
Is there a problem with the watchdog?

My guess is yes...when the timer delay exceeds the watchdog interval the watchdog triggers ( maybe the timer doesn't reset the watchdog) and resets the esp8266
... when the watchdog interval is less than the timer delay there are MCU cycles available outside the timer to reset the watchdog
User avatar
By gerardwr
#2952
zeroday wrote:@all
A new build of firmware has released.
add adc.read() api, to read adc value of esp8266, not tested.


I assume that adc.read(0) reads the ADC value on the TOUT pin, is that correct?

I don't have a connection to the TOUT pin, but a short test indicates that the ADC value is fluctuating, that's a promising sign. Perhaps there is someone with a board that has a pin on TOUT and could do a similar test to confirm that it really works. Touching the pin with a finger would probably result in a changing value ;-)

I used the following function that prints the ADC value regularly on the console.
Code: Select allfunction adcprint(freq)
-- This functions prints the adc value to the console every #msecs
-- Usage : adcprint(3000)
  tmr.alarm(freq, 1, function() print("ADC(0):" .. adc.read(0)) end )
end

Output on the console is:
Code: Select allNodeMcu 0.9.2 build 20141119  powered by Lua 5.1.4
> adcprint(3000)
> ADC(0):51
ADC(0):43
ADC(0):43
ADC(0):43
ADC(0):44
ADC(0):44
ADC(0):44
ADC(0):44
ADC(0):81
User avatar
By gerardwr
#2954 For debugging, a list of all functions can come in handy.

The line of code below shows how to list all tables and function in the global Lua environment (_G).

The list starts with the built-in functions and tables, the lines AFTER "ipairs.function" are my own functions.
Code: Select all>
> for n,v in pairs(_G) do print (n,v) end
[code]module.function: 3fff6700
h.table: 3fff6bf8
pairs.function: 3fff6098
newproxy.function: 3fff6170
package.table: 3fff62a0
_G.table: 3fff5a68
__index.lightfunction: 40228abc
ipairs.function: 3fff5fe0
adcprint.function: 3fff6240
tellme.function: 3fff6038
help.function: 3fff61c8
listap.function: 3fff61f0
connecttoap.function: 3fff6218
httpserver.function: 3fff5ec0
require.function: 3fff6750
printfile.function: 3fff6fe8
>
User avatar
By Redshiftman
#2956 Hi,

I have a couple of questions.
1. I can create a function body and I can then call that function and it works great. If I need to delete the function is there a command I can call to release it?

2. I can create a Telnet session with Hyperterminal but as soon as I start to use it, lua restarts. Is this a known problem at the moment? I'll try with some other Telnet clients.

Many thanks to zeroday for implementing this firmware in this great little device.

Dave