- Wed Nov 19, 2014 5:10 pm
#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