int b = 0;
int r = 0;
void setup() {
GPIOB->MODER = 0x15554;
GPIOA->MODER = 0x5;
pinMode(PB0, INPUT_PULLDOWN);
}
void loop() {
if(digitalRead(PB0)==1){
GPIOB->ODR = 0;
b += 1;
if (b == 7){
b = 0;
}
delay(500);
r = 0;
}
switch(b){
case 0:
GPIOB->ODR = 0;
GPIOA->ODR = 0;
break;
case 1:
GPIOA->ODR = 3;
GPIOB->ODR = 0x1FE;
break;
case 2:
GPIOB->ODR = 0x1E;
break;
case 3:
GPIOB->ODR = 0x1E0;
break;
case 4:
if(r == 0){
delay(100);
GPIOB->ODR = 0xAA;
r++;
}
else{
delay(100);
GPIOB->ODR = 0x154;
r = 0;
}
break;
case 5:
if(r == 0){
delay(100);
GPIOB->ODR = 0xA;
r++;
}
else{
delay(100);
GPIOB->ODR = 0x14;
r = 0;
}
break;
case 6:
if(r == 0){
delay(100);
GPIOB->ODR = 0xA0;
r++;
}
else{
delay(100);
GPIOB->ODR = 0x140;
r = 0;
}
break;
}
}