what is code for ADC data on coapp(Single channel)?
what is code for ADC data on coapp(Single channel)?
Where did you place the example? It should be extracted in nrf51_iot_sdk_0.8.0_f1f6187\Nordic\nrf51\examples\iot
and the main.c file should then be found in nrf51_iot_sdk_0.8.0_f1f6187\Nordic\nrf51\examples\iot\coap_adc\ipv6\server
. Is this how your setup looks? If it is not placed in the correct directory, your project will not find the files, as the paths are relative.
Also, make sure you added the path to the adc header files to your project as this:
And that you have all the following files (in the specified path):
nrf51_iot_sdk_0.8.0_f1f6187\Nordic\nrf51\components\drivers_nrf\adc\nrf_drv_adc.c
nrf51_iot_sdk_0.8.0_f1f6187\Nordic\nrf51\components\drivers_nrf\adc\nrf_drv_adc.h
nrf51_iot_sdk_0.8.0_f1f6187\Nordic\nrf51\components\drivers_nrf\hal\nrf_adc.c
nrf51_iot_sdk_0.8.0_f1f6187\Nordic\nrf51\components\drivers_nrf\hal\nrf_adc.h
i could compile the code.i connected input at pin P0.01 and i was getting default values(482,491,492).even if input was not connected.
Hi, did you use your own example or the one I provided? I see that I set the ADC to use AIN0, which is also used for crystals. If you have not done this already, you should change the line:
static nrf_drv_adc_channel_t m_channel_config = NRF_DRV_ADC_DEFAULT_CHANNEL(NRF_ADC_CONFIG_INPUT_0);
to:
static nrf_drv_adc_channel_t m_channel_config = NRF_DRV_ADC_DEFAULT_CHANNEL(NRF_ADC_CONFIG_INPUT_2);
If you want to use P0.01 (AIN2).
thank you sir it is working properly .