Pin as GND

Is there an way to programme a pin to act as GND???
thanks

Setting the pin LOW using digitalWrite will set the pin to ground potential but the current capacity is limited compared to a true ground. What are you trying to do?

Absolutely, taking the pin low does it. Just dont hook anything greater that 40mA to that pin or else the magic smoke comes out and its hard to put back in. :wink: And you shouldnt put any inductive loads on it, ie motor or something with a magnet. But yes for an led or a sensor you can absolutely use a pin as gnd.

Brian

That’s my cheap bicolor LED trick; tie it to two pins. One high, one low, and the LED is red. Switch to one low, one high, and the LED is green.

That’s my cheap bicolor LED trick; tie it to two pins. One high, one low, and the LED is red. Switch to one low, one high, and the LED is green.

Cycle them back and forth quckly and the LED is yellow :wink: