Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stm32f10x.h>
- #include <stm32f10x_gpio.h>
- #include <stm32f10x_rcc.h>
- #define RED_LED GPIO_Pin_3
- int main(void)
- {
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
- GPIO_InitTypeDef LED;
- LED.GPIO_Pin = RED_LED;
- LED.GPIO_Mode = GPIO_Mode_Out_PP;
- LED.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_Init(GPIOB, &LED);
- GPIO_SetBits(GPIOB, RED_LED);
- GPIO_ResetBits(GPIOB, RED_LED);
- while(1)
- {
- GPIO_SetBits(GPIOB, RED_LED);
- for(int i = 0; i < 100; i++);
- GPIO_ResetBits(GPIOB, RED_LED);
- for(int i = 0; i < 100; i++);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement