Embedded
PB0 Functions Function Description GPIO Input Read a push button or switch GPIO Output Control an LED, relay, or buzzer ADC Input Read analog signals from sensors (if enabled on this pin) EXTI External interrupt input Timer / Alternate Function PWM generation or timer input/output (depending on the timer mapping) Common Uses 1. LED Control HAL_GPIO_WritePin ( GPIOB , GPIO_PIN_0 , GPIO_PIN_SET ); // LED ON HAL_GPIO_WritePin ( GPIOB , GPIO_PIN_0 , GPIO_PIN_RESET ); // LED OFF 2. Push Button if ( HAL_GPIO_ReadPin ( GPIOB , GPIO_PIN_0 ) == GPIO_PIN_SET ) { // Button is pressed } 3. Analog Sensor You can connect: Potentiometer LM35 Temperature Sensor LDR Soil Moisture Sensor (analog output) to PB0 if it is configured as an ADC input. 4. PWM Output PB0 can be configured as a timer output to: Control LED brightness Drive a servo motor Control DC motor speed Pin Type PB0 │ ├── GPIO ├── ADC ├── EXTI └── Timer (Alternate Function) In STM32CubeMX Click PB0 and you...