Quick question about I/O

Can a input and/or output be configured as an internal switch....connect to each other to complete or open a circuit. (low volt/current)? Or do you need always an external device?

More information please.

.

Hi,
This was asked not long ago.
No you cannot use two output pins as an internal switch, the controller outputs can only give, +5V or 0V.
You need to connect an output to a relay and use the relay contacts as a switch.

Tom... :slight_smile:

You can connect an output pin and an input pin and check the input pin for the logic level of the output pin

const byte inputPin = 5;
const byte ouutputPin = 6;

void setup()
{
  pinMode(inputPin, INPUT);
  pinMode(outputPin, OUTPUT);

  Serial.begin(115200);
}

void loop()
{
  digitalWrite(outputPin, HIGH);
  Serial.println("output pin set HIGH");

  int inputStatus = digitalRead(inputPin);
  Serial.print("input pin reading: ");
  Serial.println(inputStatus);

  delay(1000);

  digitalWrite(outputPin, LOW);
  Serial.println("output pin set LOW");

  int inputStatus = digitalRead(inputPin);
  Serial.print("input pin reading: ");
  Serial.println(inputStatus);

  delay(1000);
}

If you connect the input pin and the output pin with a piece of wire, the input pin will read the status of the output pin. For the reIGH and 0 means LOW.

I'm not sure what you want to achieve; maybe a more detailed explanantion oof what you want to achieve is in place.

They could read the output pin with a digitalRead too.

.

Need more info what the OP is doing.

.

LarryD:
Need more info what the OP is doing..

He is pulling your chain. he abandoned this thread
http://forum.arduino.cc/index.php?topic=433676.15

nineball:
Can a input and/or output be configured as an internal switch....connect to each other to complete or open a circuit. (low volt/current)?

No.

no the goal of that thread was basically the same as this thread switch state = momentary output - Project Guidance - Arduino Forum which was was resolved.

I also have two wires that need and open and closed state...like a switch. (the factory t-stat input)..that I was thinking of toggling the outputs of the T-stat back to that, based on an added outside temp sensor. So if they were say..connected to two input pins and the temp was below x deg...don't do the relay thing ...connect
the two pins....like a switch.

I was wondering if I needed another relay or transistor..or similar to switch that state of if it could be done internally by the Arduino...with out an external device

One wire to GND. Other wire from pin set to INPUT_PULLUP. Reading that other pin will read HIGH until the wires touch.
OP is working with some serious misunderstandings of how things work and even less versed with vocab, but just seems a simple goal made difficult by that.

One wire to GND. Other wire from pin set to INPUT_PULLUP. Reading that other pin will read HIGH until the wires touch.

Which is the inverse of what I think he is asking. I think he wants two outputs to be joined together to imitate a switch for an external circuit.

Anyway what was suggested here will only work if this switch has no other circuit connected to it.

I see, so trying to make the arduino a transistor-as-a-switch.

Good news is, all he needs is a transistor, then.

INTP:
Good news is, all he needs is a transistor, then.

Yes providing the two systems are floating with respect to each other and the system provides sufficient current and the two wires to the system are the right way round. I have also come across cases where a transistor had to be replaced by a FET for this to work.

amazing ..Mike...I actually understood that English...just gotta look up Fet vs. Transistor ...except the T in FET... IS transistor.....(i guess relay it is)

But it is amazing how a "switch" (open and closed contacts) can get so complicated.

Difficulty is relative to ignorance

Yes the T in FET is transistor but it is common usage to call bipolar transistors just transistors because that is what they were called before the FET was invented. It is just like the first version of any hardware it is called just the name then when the second version comes along the origional is called version one.

Thanks for the explanation...Mike.............But you seem to be a petty knowledgeable guy...and have obviously been around a while....47K posts....and I'm aware that really smart people have no patience for seemly simple things....But the people that come here prolly aren't as smart as you...and they are looking for help and direction without the criticism of lack of knowledge. Cause if they had that knowledge they prolly wouldn't be here.

So as smart as you are..I would have thought that a more appropriate response would have been to explain the difference between a transistor and a FET rather than the rhetoric.

A transistor's collector current is controlled by 'current' flowing through its Base.
A FET's drain current is controlled by 'voltage' on its gate.

Each has a gain factor that you take into consideration in circuit design.

A few hours with: Goggle, looking at youtube videos and reading tutorials will give you a good understanding of both.

.

Thanks Larry....yea..Google and youtube..r my best buddies..

MOS FETs

.