Using pins as Ground?

Just found this in the reference section:

"Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits."

Im not sure tho, if i just should set the pins to Input, or what else i should do for them to act as Ground. Dont want to risc my Arduino that willingly, so i thought id ask the public before testing?

Is it even possible to do what i want?

To use a pin as ground set as an output and digitialWrite LOW to the pin.

Oh, thanks!

Just for clarification,
If i set the pin to HIGH, it wont be ground anymore, and again setting it to LOW it will be ground? HIGH mode wont cause any conflicts? (connected to the cathode of a led)

I want to be able to switch the ground on/off, without damaging the Arduino. :slight_smile:

An I/O pin has three states: LOW (same as ground), HIGH (same as Vcc), and high-impedance (virtually disconnected). When in input mode, the pin is in high-impedance state.

For example, wire this up: PIN4----////----|>|----PIN5. The wiggly line is a 220 ohm resistor. The other part is a diode, with the cathode leg toward the PIN5.

  • If either PIN4 or PIN5 are set to INPUT mode, the circuit will pass virtually no current.

  • If both PIN4 and PIN5 are HIGH, the circuit will pass no current, since there's no potential difference.

  • If both PIN4 and PIN5 are LOW, the circuit will pass no current, since there's no potential difference.

  • If PIN4 is LOW and PIN5 is HIGH, the diode stops current from flowing.

  • If PIN4 is HIGH and PIN5 is LOW, the diode allows current to flow easily, the resistor slows the flow so the diode won't burn out, and if the diode is an LED, it lights up.

What are you actually trying to accomplish?

Thanks for the greatly detailed description, couldnt ask for more!

I am using this method in an attempt of doing a LED Matrix, using 8 pins on my Arduino as the Rows, and a 74HC595 as the Col's.

Im quite the beginner when it comes to programming in Arduino (my skills are mainly in Max/Msp), so ground is a bit shaky as of now. On the other hand, i can read code and understand it, so in time..

Should be fine. Just put the resistors on the 595-side, so they each have their own current limited independently. One row at a time, all columns at the same time.

columns
+-----+                +----------+
|     +---/\/\/\----| matrix   |
| 595 +---/\/\/\----| . . . .  |
|     +---/\/\/\----| . . . .  |
+-----+                +----------+
                 | | | |
                 rows

Thats exactly how im doing it now, good to know im on the right path!