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

can i use an analog pin as a digital pin........?

hai

in nrf51822 the pins p0.01 t0 p0.06 are marked as analog pins in the nrf51822 DK. i know that in arduino we can use an analog pin as an analog input as well as a digital in/out. so like that can i use any pin from p0.01 t0 p0.06 as a digital in/out pin.......?

Parents Reply Children
  • how to set an analog pin as digital out. can you give me the syntax. is it same as setting a digital pin...?

  • Yes, 100% the same as using any digital pin. You can configure the pin as output with the function nrf_gpio_cfg_output(pin number). See infocenter page here.

    After that use nrf_gpio_pin_set(pin number) to set the pin high, and nrf_gpio_pin_clear(pin number) to set the pin low.

  • actually i am working with mbed compiler to program. and i have tried p6 same as a digital pin. but the behaviour is not as expected.

  • Are you using a nRF51-DK? Is it only P0.06 you have problem with? The other pins are working as expected ?

  • hai. i am using a custom board of nrf51822. now the problem is solved . the issue was with the mbed API. thank you for your help.