TX1 pin in mega2560 board

i have made an obstacle detecting circuit using an IRLED a photodiode and a mega2560 board. I have set digital pin 2 and 3 as output and high. Longer pin of LED is connected to digital pin 2 and shorter one is grounded. Longer pin of photodiode is connected to analog pin 0 and shorter one is connected at different pins one by one. No resistors or any other thing is used.

the code is simple and as given:

void setup() { pinMode(2,OUTPUT); pinMode(3,OUTPUT); digitalWrite(3,HIGH); // for experiments digitalWrite(2,HIGH); // for IRLED Serial.begin(9600); } void loop() {

Serial.println(analogRead(0)); // for getting readings of sensor (photodiode).

}

now depending upon connection of smaller pin of photodiode following cases are happening:

case 1 : Shorter pin of photodiode is connected to digital pin 3 or the pin giving 5V The analogread values are fixed at 1023 and not at all changing on obstructing the LED.

case 2 : Shorter pin of photodiode is connected to pin giving 3V. The analogread values are fixed at 680 and not at all changing on obstructing the LED.

case 3 : Shorter pin of photodiode is connected to digital pin TX1. The analogread values are giving ambient reading as 580 and when we move hand closer to sensor the values are decreasing and finally reaching zero. On moving hand away the values are again becoming 580.

So we can say that the sensor is detecting obstacles only when shorter pin of photodiode is connected to TX1 Is this pin has something special in it? Plzz tell.

Longer pin of LED is connected to digital pin 2 and shorter one is grounded.

This may destroy your Mega2560, at least the output buffer of pin2 as it draws much more current than a single pin may deliver. Always use a current limiting resistor in series with the LED!