Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By gsaidah
#31949 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
User avatar
By xtal
#31968 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
User avatar
By mrburnette
#32072 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