Arduino Uno Board Voltage Error

The code I used is as follows.
The module used is an 8x32 dot matrix, PCA9685 servomotor driver.
When a current flows through pins 2 to 9, the number of the pin through which the current flows appears on the serial monitor and the score in the 8x32 dot matrix increases by 10.
In the circuit, VCC was connected to 5V, 8x32 dot matrix was connected to 10, 11, and 12 pins in the order of CS, CLK, and DIN, and PCA9685 was connected to A4 and A5.

But the problem arises here.
As a result of the execution, the serial monitor showed a pin number and continued to increase the score without electric current flowing through the lines plugged into pins 2 to 9 or even without plugging in the lines themselves.
I changed the board itself for fear of poor contact, but the results were the same.
It was confirmed through the serial monitor that electric current flowed through 8 to 12 pins every few seconds.

No matter how hard I look, I don't know the cause of the problem.
If you know the cause, please help.

#include "LedControl.h"
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

LedControl lc=LedControl(12,11,10,4);

Adafruit_PWMServoDriver pwm=Adafruit_PWMServoDriver();

int point = 0;

int t2,t3,t4,t5,t6,t7,t8,t9;


byte num[11][8] = {
  {
    B00111000,
    B01000100,
    B01000100,
    B01000100,
    B01000100,
    B01000100,
    B01000100,
    B00111000
  },
  {
    B00010000,
    B00110000,
    B00010000,
    B00010000,
    B00010000,
    B00010000,
    B00010000,
    B00111000
  },
  {
    B00111000,
    B01000100,
    B00000100,
    B00000100,
    B00001000,
    B00010000,
    B00100000,
    B01111100
  },
  {
    B00111000,
    B01000100,
    B00000100,
    B00011000,
    B00000100,
    B00000100,
    B01000100,
    B00111000
  },
  {
    B00000100,
    B00001100,
    B00010100,
    B00100100,
    B01000100,
    B01111110,
    B00000100,
    B00000100
  },
  {
    B01111100,
    B01000000,
    B01000000,
    B01111000,
    B00000100,
    B00000100,
    B01000100,
    B00111000
  },
  {
    B00111000,
    B01000100,
    B01000000,
    B01111000,
    B01000100,
    B01000100,
    B01000100,
    B00111000
  },
  {
    B01111100,
    B00000100,
    B00000100,
    B00001000,
    B00010000,
    B00100000,
    B00100000,
    B00100000
  },
  {
    B00111000,
    B01000100,
    B01000100,
    B00111000,
    B01000100,
    B01000100,
    B01000100,
    B00111000
  },
  {
    B00111000,
    B01000100,
    B01000100,
    B01000100,
    B00111100,
    B00000100,
    B01000100,
    B00111000
  },
  {
    B00000000,
    B01111100,
    B01100110,
    B01100110,
    B01100110,
    B01111100,
    B01100000,
    B01100000
  }
};


void sb() {
  int s1 = point/100;
  int s2 = point%100/10;
  int s3 = point%100%10/1;
  
  for (int i=0; i<10; i++) {
    for (int j=0; j<8; j++) {
      lc.setRow(0, j, num[s3][j]);
    }
  }
  for (int i=0; i<10; i++) {
    for (int j=0; j<8; j++) {
      lc.setRow(1, j, num[s2][j]);
    }
  }
  for (int i=0; i<10; i++) {
    for (int j=0; j<8; j++) {
      lc.setRow(2, j, num[s1][j]);
    }
  }
  for (int i=0; i<10; i++) {
    for (int j=0; j<8; j++) {
      lc.setRow(3, j, num[10][j]);
    }
  }
}


void setup() {
  Serial.begin(9600);
  
  for(int i=0; i<4; i++) {
    lc.shutdown(i,false);
    lc.setIntensity(i,2);
    lc.clearDisplay(i);
  }

  pwm.begin();
  pwm.setPWMFreq(51);

  pinMode(2, INPUT_PULLUP);
  pinMode(3, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
  pinMode(6, INPUT_PULLUP);
  pinMode(7, INPUT_PULLUP);
  pinMode(8, INPUT_PULLUP);
  pinMode(9, INPUT_PULLUP);

  for (int fs=0; fs<10; fs++) {
    pwm.setPWM(fs,0,0);
  }
}

void loop() {
  sb();
  
  int pin2 = digitalRead(2);
  int pin3 = digitalRead(3);
  int pin4 = digitalRead(4);
  int pin5 = digitalRead(5);
  int pin6 = digitalRead(6);
  int pin7 = digitalRead(7);
  int pin8 = digitalRead(8);
  int pin9 = digitalRead(9);

  if (pin2 == 1) {
    point = point+10;

    pwm.setPWM(2,0,175);
    Serial.println("2");
  }
  if (pin3 == 1) {
    point = point+10;

    int r3 = constrain(map(10, 0, 180, 150, 600), 150, 600);
    pwm.setPWM(3,0,r3);
    Serial.println("3");
  }
  if (pin4 == 1) {
    point = point+10;

    int r4 = constrain(map(10, 0, 180, 150, 600), 150, 600);
    pwm.setPWM(4,0,r4);
    Serial.println("4");
  }
  if (pin5 == 1) {
    point = point+10;

    int r5 = constrain(map(10, 0, 180, 150, 600), 150, 600);
    pwm.setPWM(5,0,r5);
    Serial.println("5");
  }
  if (pin6 == 1) {
    point = point+10;

    int r6 = constrain(map(10, 0, 180, 150, 600), 150, 600);
    pwm.setPWM(6,0,r6);
    Serial.println("6");
  }
  if (pin7 == 1) {
    point = point+10;

    int r7 = constrain(map(10, 0, 180, 150, 600), 150, 600);
    pwm.setPWM(7,0,r7);
    Serial.println("7");
  }
  if (pin8 == 1) {
    point = point+10;

    int r8 = constrain(map(10, 0, 180, 150, 600), 150, 600);
    pwm.setPWM(8,0,r8);
    Serial.println("8");
  }
  if (pin9 == 1) {
    point = point+10;

    int r9 = constrain(map(10, 0, 180, 150, 600), 150, 600);
    pwm.setPWM(9,0,r9);
    Serial.println("9");
  }
}

Well done posting the code in code tags.
Can You post a copy of the serial monitor output? Use code tags for the text!
Word sallad as we say here is not appreciated. Misunderstandings are always there.

I agree with @Railroader, words do a poor job of describing circuits. The schematic diagram is the language that we use to describe electronic circuits. A hand drawn, photographed and posted schematic is perfectly acceptable. If you would like to do a CAD generated schematic the how to make a schematic you can post tutorial will get you started.

Please add comments to your code so we can know what it is supposed to do.

map(10, 0, 180, 150, 600)

Why the map? What do you expect it to do? That is just an over complicated way of saying 175.

And so this:

constrain(map(10, 0, 180, 150, 600), 150, 600);

is just constrain(175, 150, 600); Since 175 is already between 150 and 600, that does nothing.

Did you read this part of the constrain reference?

Notes and Warnings

Because of the way the constrain() function is implemented, avoid using other functions inside the brackets, it may lead to incorrect results.

The map function would fall into the category of other functions.

Interesting! Apologies for hijacking the topic a little but can you please give an example of how that might go wrong?

I was repeating the warning in the reference. I don't know if using map in the constraint is bad or not. The warning does not specify which functions to avoid, it just says avoid using other functions inside the brackets.

When a pin is set to PULLUP what do you expect to be on the pin when a digital read is done?

Of course pin2 will be a HIGH or a 1 because the pin is pulled high!!

Can't fault your logic... Still fascinated to see an actual example... Maybe we should set this challenge in the "Bar Sport" section!

  • The score increments when any of the pins 2 to 9 is high.

  • You have enabled pullups on pins 2 to 9.

  • This causes pins 2 to 9 to be high - unless you do something to over-ride that.

  • The score will increment unless you hold ALL of the pins 2 to 9 low.

How are you holding pins 2 to 9 low to prevent the counter incrementing?

I think my explanation was insufficient.

First of all, the reason why I set INPUT_PULLUP is that I will use the button for the way the power flows.
Also, the results were the same even if it was set as INPUT.

And the reason I used the code 'constrain (10, 0, 180, 150, 600), 150, 600;' is because there are not many examples of servomotor drivers in Korean, so I followed the most basic example.
The example with the above code was a code that adjusted the angle according to the user's input.
"175" is the code that I checked if I could use instead of the above code.

Serial monitor results vary from time to time.
Literally random numbers appear on the monitor.
The results I just ran were 5, 2, 9, 6, 1, 5, 2, 9, 6, 1.