Sparkfun Pro Mini: Shorting Tx and Rx

While the board is connected to power is it possible to short the Tx and Rx pins together for a second without damaging any components?

If so, would it possible to read the state when both pins are shorted?

void setup()
{

????

}

void loop()
{

Tx_Rx_Short = read status

if(Tx_Rx_Short == true) do something special;

}

Thanks.

Shorting those two pins together won't cause any harm unless one pin is driving HIGH and the other pin is driving LOW. Why are you checking if those two pins are shorted together? Are you using a pushbutton to do this? If so, you should look into using the pull-up resistors built into the Arduino.

Here's a tutorial about using a pushbutton and a pull-up resistor: http://www.arduino.cc/en/Tutorial/Pushbutton

A better way would be to use the internal pull-up resistors in the Arudino: http://arduino.cc/en/Tutorial/DigitalPins

Thanks Kurt.

I only have those 2 pins to go with and I don't have an option with pull-ups unless they are already on the Pro Mini as default. No pushbutton will/can be used. The short will be done with any kind of metal object.

The pins are in a dead state with the Pro Mini only being powered by a battery (Lipo) but only until it gets hooked up to a USB port.

So what would you suggest? How can I read the state using the code example I posted?

byte Pin1 = 1;
void setup(){
pinMode (Pin1, INPUT);
digitalWrite (PIN1, HIGH); // turn on internal pullup
}
void loop(){
if (digitalRead (Pin1) == LOW){
// pin is shorted to Gnd
}
}

The RX pin is D0 and the TX pin is D1. According to http://arduino.cc/it/Main/ArduinoBoardProMini, all of the digital pins have interal pullup resistors. You can set D0 as an INPUT, turn on the pullup resistor on D0, and drive LOW on D1. When you read the value on D0, LOW means there is a short, and HIGH means there is an open.

void setup()
{
  pinMode(0, INPUT);
  digitalWrite(0, HIGH); 
  pinMode(1, OUTPUT);
  digitalWrite(1, LOW); 
}

void loop()
{
  if(digitalRead(0) == LOW)
  {
    //do something special
  }
}

Thanks guys.

@Kurt: That's exactly the confirmation I was looking for. I was to chicken to experiment. I will let you know here if the result turned out as planned.

Glad to help :slight_smile:

Could you not use an analog input to read a switch?

kf2qd:
Could you not use an analog input to read a switch?

Yeah, I suggested that, but apparently he can't add a button to his design.

A switch is heavy and uses space.

The 2 pins on the mini on other hand are present. So if I can use them as a switch aswell, then I'm happy :slight_smile:

Pro mini? You have the 2 inboard pins as well, A4 and A5 (D18, D19).

Here is something I quickly put together.

I think it should answer some questions.

kurt_t:
The RX pin is D0 and the TX pin is D1. According to http://arduino.cc/it/Main/ArduinoBoardProMini, all of the digital pins have interal pullup resistors. You can set D0 as an INPUT, turn on the pullup resistor on D0, and drive LOW on D1. When you read the value on D0, LOW means there is a short, and HIGH means there is an open.

void setup()

{
  pinMode(0, INPUT);
  digitalWrite(0, HIGH);
  pinMode(1, OUTPUT);
  digitalWrite(1, LOW);
}

void loop()
{
  if(digitalRead(0) == LOW)
  {
    //do something special
  }
}

Well, that was a fight I didn't anticipate in but I finaly got the above code to work.

Turns out if you have Serial.begin(xxx); activ digitalRead(0) will always be HIGH.

That in turn caused quit a few new problems which thankfully I have managed to solve aswell.