Ok, it looks like you are having a pin mapping problem, the pin value is actually not converted from gpio number to adc pin number (which probably should). Please look at the board schematics, in order to know which adc input pin is the one you want to use, as far as I recall the Arduino analog pins on the board don't map directly to the ADC input pins on nrf52xxx boards.
On Wed, 10 Jun 2020, 22:13 Mo Chen, <shanyechu...@gmail.com> wrote: > Hi Miguel, > > I guess the problem is I am not sure what to input to the following > structure: > > for "cc.pin", is my input correct? I tried NRF_SAADC_INPUT_AIN1 and ( > nrf_saadc_input_t)(NRF_SAADC_INPUT_AIN1). No luck. For nrf52, what should > I input to it? > > also the same for "cc.pin_negative" > > Thanks, > > struct adc_chan_cfg cc = { > .pin = (nrf_saadc_input_t)(NRF_SAADC_INPUT_AIN1), > .differential = false, > .pin_negative = (nrf_saadc_input_t)(NRF_SAADC_INPUT_DISABLED), > .gain = ADC_GAIN1_6, > .reference = ADC_REFERENCE_INTERNAL > }; > > On Wed, Jun 10, 2020 at 2:42 PM Mo Chen <shanyechu...@gmail.com> wrote: > > > Hi Miguel, > > > > Yes, I understand that the code you sent doesn't include BLE functions. > > > > I modified the code on the Mynewt official website by adopting the ADC > > configuration. > > > > The switch (etype) structure stuck the execution. So I removed the switch > > structure and just did the same as the example shown in the link: > > > > https://mynewt.apache.org/latest/tutorials/sensors/nrf52_adc.html > > > > Still, the ADC give a value a 0 volt. > > > > The code on the official Website runs normally with 1.7.0. > > > > I think there must be something wrong with the ADC configuration. > > > > My goal is to have the example code on the official website run with > 1.8.0. > > > > https://mynewt.apache.org/latest/tutorials/sensors/nrf52_adc.html > > > > Would you please help look into this? > > > > Thanks for your help! > > > > > > > > On Wed, Jun 10, 2020, 13:22 Miguel Azevedo <miguella...@gmail.com> > wrote: > > > >> Hi Mo, > >> > >> I am currently away from my computer but the example app supposedly > >> doesn't > >> have any Bluetooth features enabled. I'll give a closer look on your > issue > >> tomorrow, by the way keep in mind that the code I posted the link for > >> belongs to a branch which is slightly different from master. > >> > >> On Wed, 10 Jun 2020, 17:31 Andrew Stevenson, <and...@ugh.net.au> wrote: > >> > >> > > >> > > >> > > On 10. Jun 2020, at 17:26, Mo Chen <shanyechu...@gmail.com> wrote: > >> > > > >> > > Hi Andrew, > >> > > > >> > > Would you please attach the blog post you mentioned? > >> > > >> > It was attached so I guess the mailing list software strips > >> attachments. I > >> > have CCed you on this message so you should have two copies, one with > >> the > >> > attachment. > >> > > >> > Andrew > >> > > >> > > >> > > >> > > >> > > Mo Chen > > > > > -- > Mo Chen >