I have three wires attached to three pins on my Arduino, I would like to know how connect two of three wire in different state of the code ?

Here is an example:

Cond 1 = Pin 1 <-> Pin 2
Cond 2 = Pin 1 <-> Pin 3
Cond 3 = Pin 1 is not connected to any Pin (1 or 2)…

If you want to use only Pin1,2,and 3,and no extra pin, then use an analog input pin on pin1. connect two 10k resistor from GND to VCC, and connect the middle point to Pin1:


drive Pin2 high, and Pin3 low.

keep reading PIN1 analog inpout and based on your reading:
If Pin1 close to 0, then P1<->P3
if pin1 close to 255(8 bit analog) then P1<->P2
if pin1 is close to 125(8 bit analog, maybe ±20) then P1 is disconnected from P2 and P3.

Thanks or input..... regards to first reply, there are no switchs, they just wires that that have been assign to a pin......

Regards to second reply, how would I define pin 2 and 3, as an input or a output ?

thx Amir

One more question..... the state of p1 connection to P2 or P3 needs to be controlled by my code and not by an external switch.

thx Amir

Sorry about that, here is what I am trying to build, A suntracker using Arduino board, a GPS shield and motor control. The motor control is "LED3XS24Vc3RM " board from Redrok


The board has 4 wires 1-4 to control a motor with external power supply ( there are also addition 4 connectors , two for motor and two external power supply for motor)....

Wire 1 is a power pin and need 5v, which it can be provided from Arduino board, pin 2-3 need to be programmed as follow:

  1. Leaving CONN2-pin2 and CONN2-pin3 open will cause the PU to drive the motor Reverse or to the Red direction. This is also the "Parking" direction.
  2. Connecting CONN2-pin3 to CONN2-pin4 will cause the PU to stop moving the motor.
  3. Connecting CONN2-pin2 to CONN2-pin4 will cause the PU to drive the motor Forward

Hope these helped

thx Amir

Thanks for prompt response..... using transistors were my first option, however I did not know which one nor how to use them in this case, I will try your recommendations after locating the transistor. thx Amir

Sorry I had a typo regards to pin 1… pin 1 is not a power pin, pin 4 is which requires 5V,

I really missed up… here is the pin assignment…

PIN 1 is power (5v) Note: it an be provided by Arduino board
PIN 2-4 is control pins:
Cond 1: P4 <-> P2 … forward move
Cond 2: P4 <-> P3 ---- Stop
Cond 3: P4 not connected … Reverse move (open)


The info on Web site is very confusing, what I got from designer of the board, he emailed me and writes the board needs 5V power that needs to be supply in Pin 1, other pins 2-4 are control pins ( Pin 4 been GND). I have tested the board manually and it does work..... the only issue is how to control them via code.

thx Amir

CONN2 is not the one, it is CONN1 from

Conn2 is external power suppy and motor, take a close look at Conn1 in the diagram, there are two LEDs (LED3) above it, these are pin 2 and 3, they are labled BLACK, GREEN and RED.

I have Pin 1 of the Conn1 connected to 5V Arduino and it is working and so far I have managed not to destory my Arduino board...

You are correct, my error, however I am looking at board, thus, how I managed not to toast my board.... I am still waiting for anyone who can tell me how to program for Pin 2 and 3 as it is describe in this email trail...


no... I can write the code