How to block a pin without passing any current

I want to control a Brushless out runner motor. it has three phases. L1, L2, L3

I conected L1, L2, L3 to 4,5,6,pins and named them as L1, L2, L3 in void setup()

I need to connect L1 to the 5v and L2 to the ground and keep L3 open. This is a part of my code.
pinMode(L1, HIGH) ;
pinMode(L2, LOW) ;
pinMode(L3, LOW) ;

I need to pass currunt through only L1, L2 and keep L3 without passing any current for that moment. but it passes current through all three phases.
So I need to block L3.
In other way I need to use the pins as the switches and keep L1, L2 closed and L3 opend

how to write the code. I want to do this without using transisters as the switches

can someone help me. :frowning:
thanks

I want to do this without using transisters

Reed relays?

What is the resistance of the coils? If a pair of coils has a resistance of around 1000 ohms or more, then you can block current from L3 using

pinMode(L3, INPUT);

However, the reverse voltages created when you switch L1,2,3 on or off will damage the Arduino pins.

Also you made an error in your code:

pinMode(L1,  HIGH) ;
pinMode(L2,  LOW) ;
pinMode(L3, LOW) ;

pinMode() can accept INPUT, OUTPUT or INPUT_PULLUP. If you use HIGH or LOW you may not get the result you intended.

One of the fastest ways to destroy an Arduino is to try powering a coil or motor with an output pin.

kavinduravishka:
I want to do this without using transisters as the switches

How many Arduinos are you willing to spend before accepting that transistors and diodes are required?

You need three-state outputs (HI, LO, Z) where the Z state is equivalent to an input. All these states can be accomplished by (half) H-bridges.

keep L3 open

You can effectively make a pin "open" by setting it as an input, and writing low to turn off the pullup:

void pinHigh(p) {pinMode(p, OUTPUT); digitalWrite(p, HIGH);}
void pinLow(p) {pinMode(p, OUTPUT); digitalWrite(p, LOW);}
void pinOff(p) { {pinMode(p, INPUT); digitalWrite(p, LOW);

I want to do this without using transisters as the switches

Let us know where you've found the motors that run on ~50mA per winding...