Unable to read analog voltage using ADC on esp8266 nodemcu using C

Have connected a resistive voltage divider to ADC input pin ( A0) on nodemcu board and I am trying to read the voltage on it using C code. The statement I am using is

int value = mgos_adc_read(6);
LOG(LL_INFO, ("Voltage Read = %d", value)); .

The console output says “Voltage Read = -1”
I have following questions:

  1. Is the Pin No 6 used in mgos_adc_read(6) the correct Pin no to use? If not what is the right pin No? ( Have not been able to find this in the mongoose os documentation)
  2. Do I have to add any Config Statements in the yml file to enable the ADC ? Currently I have not added any.
  3. I have enabled the ADC by adding the following line in the app_init function as below
enum mgos_app_init_result mgos_app_init(void) {
	if(mgos_adc_enable(6))
		{
			LOG(LL_INFO, ("ADC ENABLED"));
		}
	else
		{
			LOG(LL_INFO, ("FAILED ADC ENABLE"));
		}
}

Would appreciate any help I can get to progress on this .
Thanks

You should use pin 0 in mgos_adc_enable and mgos_adc_read.

Thanks nliviu ! That did the trick.