void setup() {
  GPIOA->MODER = (GPIOA->MODER & ~0xFFFF) | 0x5555;
}

int out = 0b00000001;

void loop() {
  out = (out > 0b10000000) ? 0b00000001 : out << 1;
  GPIOA->ODR = out;
  delay(100);
}
Loading
st-nucleo-c031c6