digitalWrite() HELP!!!! Wrong Voltage!

Well, i was reading up on the website about digital write, and i recently took a simple display from a media player, and it requires 3.3-5 volts to work, and the digitalWrite() option promises 5V when set on HIGH (If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.[FROM WEBSITE]), but when i test it, it only outputs .3-ish volts! I'm stuck. :frowning:

Also, on the PWM pins, i try to drive a small motor which only requires 3 volts to run, with analog write and it doesn't...

Thats the code:

void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(2,HIGH);
Serial.println("High");
delay(1000);
Serial.println("Low");
digitalWrite(2,LOW);
delay(1000);

}

and the voltages returned are 0, .3, 0, .3, etc.

Well the code should work fine. You problem is either with your external wiring or how you are measuring the outputs. Can you sketch out how your wiring is and how and where you are measuring your outputs?

As far as your PWM output, we would have to know how much current the motor requires and how you are wiring the output to the motor. General you can't drive motors directly from an output pin as the current limit has to be less then 40ma max.

Lefty

If you don't have a current limit resistor in the circuit and that display is an LED display, the output voltage may only be a few hundred millivolts. Put a 330 ohm resistor in series and see that the voltage at the pin reads.

Jim.

Yes Jim but 0.3V is going to be too low for an LED without a resistor. Even an output going directly into a base will give 0.7V unless you have germanium transistors and I havenโ€™t seen one of those for years.

In order to clarify a couple of things, the display is a really simple number display. It one of those displays that has an 8 on it, and when voltage is applied to a pin, it lights ip a segment of that 8 corresponding to that pin. The five volt output on the arduino lights it up great, but the digital write pins don't. Thanks for all of your help! I still can't fix it though :frowning:

I would try to disconnect everything (except power supply) from the Arduino board, and then meassure the voltage between a digital pin set to high and ground. This will eliminate the possibility of something wired wrong or something defect.

Thanks MikMo! well, i think it was the wiring. But i now am having issues with motors. i am using simple motors that can run fairly fast on the arduino 5v pin. but when i use analog write (they are on pins 5 and 6, PWM pins) or digital write they wont budge... :frowning: Please help!

i am using simple motors that can run fairly fast on the arduino 5v pin.

The 5V pin is capable of supply more current than a digital pin. I think you are possibly drawing too much current. The digital pins are not designed to power motors. The same issue may apply to the display.

Also if you haven't put in that resistor on each of the display segments you are frying your output pins even though they appear to wok.