title: Using external switch as interrupt
body: <p>How do I use an external switch as an interrupt in Nucleo STM32L073RZ microcontroller? </p>
  
  <p>This is my code:</p>
  
  <pre><code>#include "stm32l0xx.h"
  #include "stm32l0xx_nucleo.h"
  #include "stm32l0xx_hal.h"
  
  static void GPIO_Init(void);
  
  int main(void)
  {
   HAL_Init();
   GPIO_Init();
   while(1)
  {
  
   }
  }    
  static void GPIO_Init(void)
  {
  
  GPIO_InitTypeDef GPIO_InitStruct;
  
  /*Configure GPIO pin : PC15 */
  GPIO_InitStruct.Pin = GPIO_PIN_15;
  GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
  GPIO_InitStruct.Pull = GPIO_PULLUP;
  HAL_GPIO_Init(GPIOC, &amp;GPIO_InitStruct);
  
  /* EXTI interrupt init*/
  HAL_NVIC_SetPriority(EXTI2_3_IRQn, 0, 0);
  HAL_NVIC_EnableIRQ(EXTI2_3_IRQn);
  }
  
  
  
  void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin_15)
  {
  HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
  }
  </code></pre>
  
  <p>Also how do I connect the external switch to my board?</p>