-->
Page 1 of 1

Esp-12e Analog pin

PostPosted: Wed Oct 21, 2015 2:32 pm
by gsaidah
Good afternoon,
I want to get the value of the ADC pin form an ESP-12e board with the IDE software, but cannot seem to get any info on that.
I tried to get it with:
analogread(0) ;
but cannot get anything but 0 as a result.
I have 0,31v going to it.
What is the exact syntax to get the value of the ADC pin in IDE?
The LUA syntax is adc.read(0).
Thank you for any help.
George

Re: Esp-12e Analog pin

PostPosted: Wed Oct 21, 2015 7:15 pm
by xtal
Here's a snippit of LUA that works for me .. adc_id = 0 TOUT is the ADC pin
Code: Select allif m_do == "RD_ADC" then
               adc_value = adc.read(adc_id)
                    if adc_value > 1023 then
                         adc_value = 1023
                    elseif adc_value < 0 then
                         adc_value = 0
                    end                                 
            end

Re: Esp-12e Analog pin

PostPosted: Thu Oct 22, 2015 6:44 pm
by mrburnette
For the ArduinoIDE, Sparkfun suggests A0
https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/using-the-arduino-addon

There’s only one analog input pin, labeled ADC. To read the ADC pin, make a function call to analogRead(A0). Remember that this pin has a weird maximum voltage of 1V – you’ll get a 10-bit value (0-1023) proportional to a voltage between 0 and 1V.



Ray