only pin 13 Works

i have an arduino uno. i am working on a mac. i'm trying to mess with the blinking code. first i try to change the pin number. i have tested each of the available pins (3, 5, 6, 10, and 11) it only works on 13. i have an led light and i have put it into pin 13. it blinks like it should. however, when i change the pin (in the code and on the arduino) it does not work. there are no error messages from the arduino program. what should i do? is there something in the code i should change or what? i am using the blinking code that came with the program, only changing the pin number.

Post your code in code tags (it is the # sign on the message dialog). That'll help to see what is going on.

Early thoughts though, are you setting your pins to be outputs?

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

i'm only changing the numbers right after it says pinmode

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
 */

void setup() {                
  // initialize the digital pin as an output.
  pinMode(12, OUTPUT);    
}

void loop() {
  digitalWrite(12, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(12, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

That should work...if it isn't, there is something else going on that may be above my pay grade :stuck_out_tongue:

As it was pointed out, you should use a proper resistor (do a quick google search for a LED resistor calculator). Pin -> Resistor -> Anode (long pin) -> Cathode (short pin) in GND.

Obviously, the long pin (+, anode) on the LED should go in to pin D12 and the short pin (- cathode) should go into the GND.

Are you suggesting that he not use a series current limiting resistor wired in series with the LED?

Wiring an Led directly to a output pin will burn out output pins and or leds. It will now be a problem for us to determine if he has a code problem, a wiring problem, burned out output pins, or burned out leds.

Lefty

When I first started, I didn't, just followed Lady Ada's documentation. But yes, that is the next step if you're brand new :slight_smile:

http://www.ladyada.net/learn/arduino/lesson1.html

I use proper resistors on my stuff, but if you're just starting, it isn't necessarily needed for a proof that something works. I guess I didn't think to argue with her. And when I tried it (I held my breath) it did work.

ah ok see i didn't know that the short end of the led had to be connected to the GND pin. well that solves that thanks!

As retrolefty pointed out, for proper LED circuits, you should put a resistor between the Digital pin on the arduino board and the long pin of the LED. This protects it and the arduino.

Those tutorials by Ladyada that I linked in the previous post are a good source for beginners. It'll teach you basic circuits and basic arduino programming.

There is a problem on that LadyAda tutorial Arduino Tutorial - Lesson 1 - Let there be blink! in that it is horribly outdated and can and does lead to damaged arduino boards. The old Arduino NG board did have a series resistor between the chip and the pin 13, so you could wire just a led between pin 13 and ground without damaging the pin. However that does not apply to any of the presently available boards or even on the NG board did not apply to the other pins.

It is a problem that keeps on returning and I'm sorry that authors don't try and make an attempt to update their content, at least those dealing with beginners tutorials.

Lefty

That I did not know. I did try it on my Duemilanove when I got it about 4-5ish months ago and it worked, so I did not assume there would be a problem if it were just a test. Seems like a dumb mistake to make/not correct?

A 330 ohm resister works just fine. I think the colors are red/orange, red/orange, brown, gold. I'm just going off of memory of when mine look like.

The colors are very specific. (and generally easy to see with good lighting, unless you're partially colorblind, a fairly common male affliction. I pull out a meter to check often, the 470/560 can look very similar to me).
Black = 0
Brown = 1
Red = 2
Orange = 3
Yellow = 4
Green = 5
Blue = 6
Violet = 7
Grey = 8
White = 9

First 2 are value, third is 10s multiplier
Then gold/silver for 5%/10% tolerance

Thus, 330 is Orange-Orange-Brown (3,3 x 10^1 = 330)
May see 4 color stripes too, adds a 3rd digit before the multiplier.

If you ever order anything from www.mpja.com, the orders ship with a nice wallet size card with resister code on one side, cat 5 wiring code on the other.