A 12V DC source or supply connection for powering compatible circuits with direct current. It uses two terminals, + and -, and must be connected with correct polarity. It is typically used as an external power input rather than a signal component.
| Pin | Signal | Description |
|---|---|---|
12V - |
power | 12V DC negative wire |
12V + |
power | 12V DC positive wire |
| From | To | Wire |
|---|---|---|
board:GND |
x1:- |
black |
This example was written and compile-checked for the arduino-uno. Codey Online adapts it to any other supported board for you.
// Canonical example for a 12V DC source component
// Note: This is a passive power source. It is not controlled by the Arduino,
// so the example focuses on the safety connection of the negative terminal to GND.
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
Serial.println("12V DC source example");
Serial.println("Connect the negative terminal of the 12V supply to Arduino GND.");
Serial.println("The positive terminal is intentionally left unconnected in this canonical example.");
}
void loop() {
// No runtime action: this component is a DC power source.
}
Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.
Start for free