const int pins[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
const int joystickPin = 0; 
const int joystickCenter = 512; 

void setup() {
  for (int i = 0; i < 10; i++) {
    pinMode(pins[i], OUTPUT);
  }
}

int counter = 0;

void loop() {
  int joystickValue = analogRead(joystickPin);
  int direction = 0;
  if (joystickValue < joystickCenter - 50) {
    direction = -1; 
  } else if (joystickValue > joystickCenter + 50) {
    direction = 1; 
  }

  counter += direction;

  counter = constrain(counter, 0, 1023);

  for (int i = 0; i < 10; i++) {
    digitalWrite(pins[i], bitRead(counter, i) ? HIGH : LOW);
  }

  delay(50);
}
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT