CooCox CoIDE Nucleo STM32F103RB Example

CooCox CoIDE Nucleo STM32F103RB Example

TONYLABS 23 Mar, 2016
Share:

GPIO Example

#include "stm32f10x.h" #include "stm32f10x_rcc.h" #include "stm32f10x_gpio.h" int main(void) {    GPIO_InitTypeDef GPIO_InitDef;    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);    GPIO_StructInit(&GPIO_InitDef);    GPIO_InitDef.GPIO_Pin = GPIO_Pin_5;    GPIO_InitDef.GPIO_Mode = GPIO_Mode_Out_PP;    GPIO_InitDef.GPIO_Speed = GPIO_Speed_10MHz;    //Initialize pins    GPIO_Init(GPIOA, &GPIO_InitDef);    static int count=0;    static int i;    static int led_state=0;    while(1)    {        static int count=0;        static int i;        static int led_state=0;        for (i=0; i<10000; ++i)            GPIO_WriteBit(GPIOA, GPIO_Pin_5, led_state ? Bit_SET : Bit_RESET);            led_state = !led_state;            GPIO_WriteBit(GPIOA, GPIO_Pin_5, led_state ? Bit_SET : Bit_RESET);            printf("%d\r\n", ++count);    } }

PWM Example

 

Like what you're reading? Subscribe to our top stories.

We will continue to update Front; if you have any questions or suggestions, please contact us!

Follow us on Medium, Twitter, Facebook, YouTube, and Dribbble.

Image Description
Written by

Hanna Wolfe

I create advanced website builders made exclusively for web developers.

3 Comments

  • Image Description
    Dave Austin 1 day ago

    As a Special Education teacher this resonates so well with me. Fighting with gen ed teachers to flatten for the students with learning disabilities. It also confirms some things for me in my writing.

    Reply
    • Image Description
      Hanna Wolfe 1 day ago

      Love it Dave! We're all about keeping it up.

      Reply
  • Image Description
    Christina Kray 2 days ago

    Since our attention spans seem to be shrinking by the day — keeping it simple is more important than ever.

    Reply

Post a comment

Stay in the know

Get special offers on the latest developments from Front.