Advertisement
Guest User

Untitled

a guest
May 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. while (1)
  2. {
  3. /* USER CODE END WHILE */
  4. int estado = HAL_GPIO_ReadPin(Bt1_GPIO_Port, Bt1_Pin); //Declaramos una variable y lo igualamos a la lectura del pin del
  5. // pin Bt1
  6. if ( estado == 1 ) { // Si estado es igual a 1 apagamos el led y si es igual a 0 lo encendemos
  7. HAL_GPIO_WritePin(Ld2_GPIO_Port, Ld2_Pin, GPIO_PIN_RESET);
  8. } else {
  9. HAL_GPIO_WritePin(Ld2_GPIO_Port, Ld2_Pin, GPIO_PIN_SET);
  10. }
  11. /* USER CODE BEGIN 3 */
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement