Toggling 5V to ON/OFF mode

Hi,

New to Arduino environment..I would like to toggle 5V pin to turn ON/OFF with a command line prompt may be via serial port is it possible to program this? OR I have to hardwire 5V to A0 or any of the analog input pins and toggle ON/OFF those pins? Any suggestions and a sample code if anyone can suggest would be appreciated..

thanks,

What do you mean by toggling the 5V on and off? Are you trying to switch some external component?

The 5V pin on the arduino is coming from the voltage regulator. The only way to turn it off would be to unplug the board.

If you are just trying to supply 5V to some component that you can turn on and off, then you can use one of the digital pins as long as the current requirements are low. Set the pin HIGH to supply 5V and LOW to turn it off. If the current requirements are more than a digital pin can provide, then use a transistor.

Don't use analog pins A0 etc, use digital pins D0 etc.

Does the blink program fill your bill. It toggles pin D13 on and off?

Yea I suppose I can use one of the digital pins to drive my component that I would like to control its ON/OFF function. I will try wiring it and running it to see if the power consumption is not a problem as someone else pointed out.

Thanks for the inputs.

What component are you trying to drive/control? Got a URL for that component? Are you trying to supply its power requirements, or just send it a control signal?

Hello; There is a way, but needs at least one more component than the arduino itself: transistors and relays, can be used to drive the flow of one voltage with a third voltage; as if it was a voltage driven potentiometer. anyway, a digital input with its value high, will display 5 volts, so for your specific case looks pointless to attempt such a thing, unless you wanted to achieve a kind of external OR operator.

Data pins do this, while the analog pins do not. Analog pins are for reading input (analog), and data pins are for sending output (on = 5V, off = ground), remembering the current restrictions.

Analog pins are for reading input (analog)

except when you use them as digital pins

pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);

@UKHeliBob,

I didn't know that. Thanks for setting me straight. I could have used that info last week... LOL