Arduino uno I/O pins output are 4.2v not 5v

hi there
i have a problem with arduino when i checked output of digital pin it gave me 4.2v instead of 5v, and i need 5v,any solution?
i don't know what is wrong, thanks for helping!
best regards

To help us help, we need to see the sketch you are using and a schematic of your project.
Do all the digital pins have the same problem?

Normally people forget to set them to be outputs when they complain of this.

yes, all pins have the same problem and here the sketch:

int pin1= 11;
int pin2= 12;
int pin3= 13;
int counter = 0;
void setup(){
 Serial.begin(9600);
pinMode(pin1, OUTPUT); 
pinMode(pin2, OUTPUT);  
  pinMode(pin3, OUTPUT);
  
}
 void loop() {
   int input = Serial.read();
   
   if (input == '3') {
      if (counter == 0) {
      Serial.print("on");
    analogWrite(pin3, 255);
     delay(5000);
      counter++;
      input = 0;
      }
   }
    if (input == '4') {
      if (counter == 0) {
     digitalWrite(pin3, LOW);
     Serial.print("low");
     counter++;
     input = 0;
      }
   }
    if (input == '1') {
       if (counter == 0) {
      Serial.print("1");
     digitalWrite(pin1, HIGH);
     
     delay(150);
      digitalWrite(pin1, LOW);
       counter++;
       input = 0;
       }
   }
    if (input == '2') {
       if (counter == 0) {
      Serial.print("2");
     digitalWrite(pin2, HIGH);
     delay(50);
      digitalWrite(pin2, LOW);
      delay(50);
      digitalWrite(pin2, HIGH);
     delay(50);
      digitalWrite(pin2, LOW);
       counter++;
       input = 0;
       
       }
       
   }
   counter = 0;
   }

zhirantaha:
yes, all pins have the same problem and here the sketch:

int pin1= 11;

int pin2= 12;
int pin3= 13;
int counter = 0;
void setup(){
Serial.begin(9600);
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT); 
  pinMode(pin3, OUTPUT);
 
}
void loop() {
   int input = Serial.read();
   
   if (input == '3') {
      if (counter == 0) {
      Serial.print("on");
    analogWrite(pin3, 255);
     delay(5000);
      counter++;
      input = 0;
      }
   }
    if (input == '4') {
      if (counter == 0) {
     digitalWrite(pin3, LOW);
     Serial.print("low");
     counter++;
     input = 0;
      }
   }
    if (input == '1') {
       if (counter == 0) {
      Serial.print("1");
     digitalWrite(pin1, HIGH);
     
     delay(150);
      digitalWrite(pin1, LOW);
       counter++;
       input = 0;
       }
   }
    if (input == '2') {
       if (counter == 0) {
      Serial.print("2");
     digitalWrite(pin2, HIGH);
     delay(50);
      digitalWrite(pin2, LOW);
      delay(50);
      digitalWrite(pin2, HIGH);
     delay(50);
      digitalWrite(pin2, LOW);
       counter++;
       input = 0;
       
       }
       
   }
   counter = 0;
   }

Ok a few questions:

How are you trying to measure the output voltage of the pins in question. As your turning them on and off a pretty quickly a digital volt meter is sure to not give an accurate measurement.

Do you have anything wired to the output pins in question? If so what?

Have you measured the arduino 5V shield pin with a good voltmeter? If so what does it measure at.

Lefty

i make one pin output and take out by a jumper wire then measure it by mutlimeter.
i connect them relay and they can't swith the relay but when i connect directly the relay to 5+ it switch.
before i did this and there was no problem//

zhirantaha:
i make one pin output and take out by a jumper wire then measure it by mutlimeter.
i connect them relay and they can't swith the relay but when i connect directly the relay to 5+ it switch.
before i did this and there was no problem//

Can you just answer my questions, one at a time that I listed below?

Lefty

4.2 is within spec:
See Section 29
VOH Output High Voltage(3), IOH = -20 mA, VCC = 5V: 4.2V

Note (3):
Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state
conditions (non-transient), the following must be observed:
ATmega48A/PA/88A/PA/168A/PA/328/P:
1] The sum of all IOH, for ports C0 - C5, D0- D4, ADC7, RESET should not exceed 150mA.
2] The sum of all IOH, for ports B0 - B5, D5 - D7, ADC6, XTAL1, XTAL2 should not exceed 150mA.
If IIOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current
greater than the listed test condition.

You would be pushing your luck to have an arduino digital output drive a relay, unless it
is some kind of special relay with a very low input requirement.

Make a circuit with a transistor to drive the relay.