This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to get adc data on coapp?

what is code for ADC data on coapp(Single channel)?

Parents
  • I have made an example, but I have not tested it (I don't have a IoT setup to test on), but I checked that the example compiles and runs.

    coap_adc.zip

    You need to copy the ADC driver and HAL from SDK 11.0.0 into your nRF51 IoT SDK directory:

    Copy the directory components\drivers_nrf\adc from SDK 11.0.0 to Nordic\nrf51\components\drivers_nrf in nRF51 IoT SDK v0.8.0.

    Copy the files nrf_adc.c and nrf_adc.h from components\drivers_nrf\hal\ in SDK 11.0.0 into directory Nordic\nrf51\components\drivers_nrf\hal in nRF51 IoT SDK v0.8.0.

    Best regards,

    Jørgen

  • 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).

Reply Children
No Data
Related