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

Lets just stick to GPIO?

Lets just stick to GPIO

  1. I am trying to initialize multiple input buttons and multiple output LEDS.

  2. I am trying to glow the LEDS with corresponding buttons. ex:- button 0 glows led0 and so on.

    // Here i can only initialize single input and output But not multiple one. #ifdef BSP_LED_0 #define GPIO_OUTPUT_PIN_NUMBER BSP_LED_0 /**< Pin number for output. */ #endif

    #ifndef GPIO_OUTPUT_PIN_NUMBER #error "Please indicate output pin" #endif

    #ifdef BSP_BUTTON_0 #define GPIO_INPUT_PIN_NUMBER BSP_BUTTON_0 /**< Pin number for output. */ #endif

    #ifndef GPIO_INPUT_PIN_NUMBER #error "Please indicate output pin" #endif

    #define BSP_LED_0 #define BSP_LED_1 LED_2 #define BSP_BUTTON_0 #define BSP_BUTTON_1 BUTTON_2

    int main(void) {

     while(1)
     {
         
         if(BSP_BUTTON_0 == 1) // Here I am facing error every time
         {
             nrf_gpio_port_pin_toggle(BSP_LED_0);
             nrf_delay_ms(500);
             
    
         }
     }
    

    } Explain my mistakes

Parents
  • Do not change the entire question! This will make it hard for other people to read the post, or the whole answer will have to be edited (like in this case). If you are editing your question (adding information etc) this should be done with "EDIT: {new info}". If you are just formatting the question, there is no need to state it. If you are changing the whole question to something else, please post another one.

Reply
  • Do not change the entire question! This will make it hard for other people to read the post, or the whole answer will have to be edited (like in this case). If you are editing your question (adding information etc) this should be done with "EDIT: {new info}". If you are just formatting the question, there is no need to state it. If you are changing the whole question to something else, please post another one.

Children
No Data
Related