Not sure why this isn't working...

From Arduino's website describing digitalWrite():

"If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V for HIGH, 0V (ground) for LOW."

However, for some reason, when I assign a pin as HIGH, its voltage is not being set to 5V. (I'm attempting to turn on and off a weak laser)

I know this because when I hook the laser up to the dedicated 5V pin, it turns on instantly, yet when I hook it up to a separate pin (7) and assign to it HIGH, it won't turn on. (The other lead from the laser is in the same ground slot the whole time).

I made this when I ran into the problem and the laser still won't turn on:

void setup()
{
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
}

void loop()
{
digitalWrite(7, HIGH);
}

I'm using an Arduino Uno. I have a feeling I'm doing something incredibly dumb, but I can't figure it out...

Arduino output pins are probably not capable of driving it what is its current consumption ? you need a transistor to drive it :slight_smile:

I know this because when I hook the laser up to the dedicated 5V pin, it turns on instantly, yet when I hook it up to a separate pin (7) and assign to it HIGH, it won't turn on.

The answer is probably simple, the arduino pins can only supply enough current to power something like a small LED. Use your multimeter to measure the current being drawn from the laser when powered from the board 5v source. You will probably need to use a transistor as a driver for the laser.

Thanks for the responses everyone.

I ultimately plan on using many lasers and I was going to use an external power source for the lasers (knowing the board as a whole was limited to the amount of current it could draw), but I was just testing to see if one would work. I guess since the dedicated 5V pin could provide enough current, I figured all the pins could (apparently not). Oh well...

Thanks again!