First code ever in Arduino, and it is not working

Hi everybody,
as a new hobby I am starting to tinker with Arduino. I saw a robot hand with Arduino that plays Rock Paper Scissors. I tried to replicate it. with some help in the forum, I ended up with this code. but it still doesn't work. can anyone help?

#include <Servo.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#include <SPI.h>
#include <Wire.h>
#include <Fonts/FreeSerif9pt7b.h>

#define i2c_Address 0x3c 
#define SCREEN_WIDTH 128 
#define SCREEN_HEIGHT 64 
#define OLED_RESET -1  

Adafruit_SH1106G Display = Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

Servo thumb;
Servo index;
Servo middle;
Servo ring;
Servo pinky;


int emgPin = A0;   // EMG sensor pin
int emgThreshold = 500;   // Adjust the threshold based on sensor readings

void setup() {

  Serial.begin(9600);

  thumb.attach(13);   // Thumb servo connected to pin 13
  index.attach(12);   // Index servo connected to pin 12
  middle.attach(11);  // Middle servo connected to pin 11
  ring.attach(10);    // Ring servo connected to pin 10
  pinky.attach(9);   // Pinky servo connected to pin 9

  thumb.write(0);
  index.write(0);
  middle.write(0);
  ring.write(0);
  pinky.write(0);
  
  Display.clearDisplay();
  Display.setTextSize(1);
  Display.setFont(&FreeSerif9pt7b);
  Display.setTextColor(SH110X_WHITE);
  Display.setCursor(15, 10);
  Display.println("Robotic Hand");
  delay(10000);

  Display.clearDisplay();
  Display.setCursor(15, 30);
  Display.println("Rock-Paper-Scissor!");
  Display.setCursor(15, 60);
  Display.println("Testing");

  thumb.write(180);
  delay(250);
  index.write(180);
  delay(250);
  middle.write(180);
  delay(250);
  ring.write(180);
  delay(250);
  pinky.write(180);
  delay(250);
  thumb.write(0);
  delay(250);
  index.write(0);
  delay(250);
  middle.write(0);
  delay(250);
  ring.write(0);
  delay(250);
  pinky.write(0);
  delay(250);

  pinMode(emgPin, INPUT);  // EMG sensor pin as input
}

void loop() {
  Serial.begin(9600);
  int emgValue = analogRead(emgPin);

   Display.clearDisplay();
   Display.setCursor(15, 30);
   Display.println("Choose:");
   Display.setCursor(15, 60);
   Display.println("1:Rock 2:Paper 3:Scis");

  if (emgValue > emgThreshold) {

    int choice = getChoice();
    displayChoice(choice);
    playGame(choice);
  }
}

int getChoice() {
  while (true) {
    if (Serial.available()) {
      int choice = Serial.parseInt();
      if (choice >= 1 && choice <= 3) {
        return choice;
      }
    }
  }
}

void displayChoice(int choice) {

  Display.clearDisplay();
  Display.setCursor(15, 30);
  Display.println("I choice:");

  switch (choice) {
    case 1:
      Display.setCursor(15, 60);
      Display.println("Rock!");
      break;
    case 2:
      Display.setCursor(15, 60);
      Display.println("Paper!");
      break;
    case 3:
      Display.setCursor(15, 60);
      Display.println("Scissors!");
      break;
  }
}

void playGame(int choice) {
  // Open/close fingers based on the selected choice
  switch (choice) {
    case 1:  // Rock
      thumb.write(180);
      index.write(180);
      middle.write(180);
      ring.write(180);
      pinky.write(180);
      delay(2500);
      thumb.write(0);
      index.write(0);
      middle.write(0);
      ring.write(0);
      pinky.write(0);
      delay(500);
      break;
    case 2:  // Paper
      thumb.write(180);
      index.write(180);
      middle.write(180);
      ring.write(180);
      pinky.write(180);
      delay(500);
      thumb.write(0);
      index.write(0);
      middle.write(0);
      ring.write(0);
      pinky.write(0);
      delay(2500);
      break;
    case 3:  // Scissors
      thumb.write(180);
      index.write(0);
      middle.write(0);
      ring.write(180);
      pinky.write(180);
      delay(2500);
      thumb.write(0);
      index.write(0);
      middle.write(0);
      ring.write(0);
      pinky.write(0);
      delay(500);
      break;
  }
}

Not unless you tell us what it should do and what it actually does

Which Arduino are you using and how are the servos powered ?

I note that you have not answered questions asked in your other topics. Please help us to help you

I also see that you are sailing close to the wind by starting multiple topics on what is basically the same project

"It does not work" does not mean anything. Does it compile? Can you upload? HGow does the behaviour differ from what you expect based on the code?

Simply put we cannot see what you have or how it is assembles much less how it is to work. In order for us to be able to help you need to help us by answering our questions. My guess is you copied a project without a clue as to what you were doing.

By the way my TV does not work? How do I fix it? Since I do not have a TV the solution is to get one. We ask question to understand what you have and what we need to solve your problem. We do not have time to just ask questions.

Post an annotated schematic as you have wired it including all grounds, power supplies etc. Frizzing is useless for debugging a problem. Also post a link to Technical information on each of the hardware items, links to amazon and alliexpress are useless.

[edit] I seem to have said nearly the same thing as @gilshultz - sorry. [/edit]

You want to build a robot. Cool.

Step one, draw what you expect your project to look like. Verify it here. You will get very good advice.

Step two: Verify that you have all your parts, to include connecting wire and power supplies.

Step three: Verify each device works "standalone." That is to say, make each device perform as expected (connect it right, make a program, make it work)

Step four: Make everything work together in a "dry run" (connected, not assembled).

Step five: Assemble and do the "wet run" (assembled).

  • Ask questions, any question, as you progress.

I choose rock (and hold zero in chino) every time.