Arduino is producing voltage on an output pin set to low

Hello,
This might be a silly question however I was wondering why my Arduino is outputting around 3.4V on a digital pin that I have set to low. My code for the project is:

'''
int pos = 9;
int gnd = 6;

void setup() {
pinMode(pos, OUTPUT);
pinMode(gnd, OUTPUT);
digitalWrite(pos, HIGH);
digitalWrite(gnd, LOW);
}
'''

For right now I am not using the void loop section of the code. The Arduino is connected to a relay and the relay will only switch terminals no-nc or vice versa when one of the terminals is at 5V and the other is at 0v. The 5V terminal in my code is represented by pos and the 0V terminal is represented by gnd. The 5V high output is outputting correctly; however, as mentioned, the 0V low output is really outputting 3.4V. I'm curious if anyone has an answer for this. The best guess I have is the voltage is somehow bleeding into that pin since it isn't supposed to be 100% a ground pin.

Thanks to anyone who can help.

what Arduino are you using? is anything connected to the pin?

Arduino Mega

Sounds like you're trying to power the relay using Adruino pins. Can't be done. The pins will be overloaded. Might be a good time to show us a schematic
.

Always show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.

I'll get pictures and a schematic to send. One sec.

... 14 hours passed...

My apologies, I ran into some extra confusion and wasn't able to work on the project over the weekend. I'll update this forum when I have a better idea of what I'm needing.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.