How Can I test if a Pin is Fried?

I believe my digital pin 1 is malfunctioning somehow. Whenever I include it in a sketch (say, to control an LED) nothing works.

One thing I tried in order to troubleshoot was declare various pins as outputs and pin 7 as an input, then have the sketch print the state of of the button. In all cases I get numerous ones and zeros printed vertically, but if I declare pin 1 as an output the serial monitor reads: " j¤ j¤ jR jR jD j¤ j¤ jR j¤ j¤ jR j¤ jR jd j¤ jR jR j¤ j¤ jP jR j$ j¤ j¤ j¤ jR j¤ j¤ jR jT j¤ j¤ jR jP j¤ j¤ jR jD. . ." horizontally.

Can anyone shed a little light on what this might mean? Thanks!

Can anyone shed a little light on what this might mean? Thanks!

Maybe, but you have to post your sketch so we don't have to pretend what we think you wrote.

Lefty

Sorry, here it is:

/* troubleshooter sketch. see how assigning a pin to an output affects results of a pushbutton on pin 7 */

int LED = 1; int BUTTON = 7;

void setup() { pinMode(LED,OUTPUT); pinMode(BUTTON,INPUT); Serial.begin(9600); }

void loop() { int val = digitalRead(BUTTON); Serial.println(val); if(val == HIGH) { digitalWrite(LED,HIGH); } else { digitalWrite(LED,LOW); } }

Update: So I've noticed that as I try this code with the LED on different pins, they all act uniquely. If the LED is set to pin 0, the led will always stay lit but the reading of serial print will correspond to wether or not the button is pressed. On 1 the led stays lit and serial print prints gibberish. 2 and 4 work fine. On 3 the led will turn on and off with the button but serial print will only print zeros. and so on. . .

I tried this without a protoshield on to make sure the problem wasn't bad wiring. I'm guessing I must have damaged the arduino with bad wiring earlier on. At least all the pins get the job done still except for 0 and 1.

Isn't pin 1 the transmit pin for the serial conection (TX)? So digitalWrite to it is gonna screw up your serial prints. And pin 0 is the receive pin (RX).

Andrew

Isn't pin 1 the transmit pin for the serial conection (TX)? So digitalWrite to it is gonna screw up your serial prints. And pin 0 is the receive pin (RX).

Yes - stay away from Pins 0 and 1 if you are planning to use hardware serial communications at any point; I think of them as "used pins" (there are ways to use them; but for most Arduino projects, especially if you are still in your "beginner" phase - is to just pretend that they can't be used).

:)