void setup() {
  Serial.begin(115200);

  GPIOB->MODER = 0x5555;

  GPIOA->MODER = 0x0000;

  analogReadResolution(12);
}

void updateLEDMeter(int value) {
  int ledsOn = (value + 31) / 32;
  int ledPattern = (1 << ledsOn) - 1;
  GPIOB->ODR = (GPIOB->ODR & ~0xFF) | ledPattern;
}

int led_toggle = 0;

void loop() {
  int value = analogRead(A0) >> 4;
  Serial.println(value);
  int btnValue = digitalRead(A1);

  if (btnValue == 1 && led_toggle == 1) {
    led_toggle = 0;
  } else if (btnValue == 1 && led_toggle == 0) {
    led_toggle = 1;
  }

  Serial.println(led_toggle);

  if (led_toggle == 1) {
    updateLEDMeter(value);
  } else {
    GPIOB->ODR &= ~0xFF;
  }

  delay(10);
}
$abcdeabcde151015202530fghijfghij