Go Down

Topic: Arduino dry contact input (Read 762 times) previous topic - next topic


CrossRoads

Code: [Select]

// read D2 and send result 10 times a second.
// reports as High unless pin is pulled Low/connected to Gnd
byte pinX = 2;
void setup(){
pinMode(pinX, INPUT);
digitalWrite (pinX, HIGH); // enable internal pullup
Serial.begin(9600);
}
void loop(){
Serial.print(digitalRead(pinX));
delay(100);
}
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

pugglewuggle

Wow, that seems easy in code. How would a circuit look that would work with this code?

CrossRoads

You either have a button that connects the pin to Gnd, or you have the output of some other device that pulls the pin low.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Busted Duck

Hey CrossRoads.
The code looks great.
I'm after the same info.
I need to be able to recognise when a clean contact has been closed without sending 5v back through the same contacts.
Hard for me to explain sorry.
Hope you can help.

Robin2

Forgive my ignorance but I have never heard of "dry contact input" before - what does it mean?

...R

phonedawgz

It's pretty hard to tell if an electrical contact is closed if you can't send electricity through it.

Is there already something connected to these contacts?

Perhaps if you explain what you are looking to do a bit more someone can help you.

retrolefty


Forgive my ignorance but I have never heard of "dry contact input" before - what does it mean?

...R


"Dry contacts" mean one is simply wiring to a set of switching contacts that contain no voltage from any other external source. A button switch is an example of a set of dry contacts, a relay is another example of having dry contacts available for the user to utilize in any way they want up to the electrical limits of the contact ratings.

Lefty

Go Up