Blink example

Hello, forum! This is my first time posting here, so apologies if this is in the wrong place. I have altered the blink program slightly as other programs were not functioning and I wanted to test the board. All the drivers are up to date and the blink example works fine on pin 13, so it must be something I'm doing wrong.

Here is my modified code:

/*
  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(9, OUTPUT);     
}

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

Here are the links to pictures of the two ways I tried wiring it: http://desmond.imageshack.us/Himg32/scaled.php?server=32&filename=60038725.jpg&res=landing

http://desmond.imageshack.us/Himg84/scaled.php?server=84&filename=54741040.jpg&res=landing

Im a newbie but you forgot at the start to put the variable.

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

  This example code is in the public domain.
 */

int pin = 9

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

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

rawriano: Im a newbie but you forgot at the start to put the variable.

Look again. The example code doesn't use the "pin" variable, and neither does yours!

bombo294: Here are the links to pictures of the two ways I tried wiring it:

[...]

Try sharing the images directly. Those URLs seem to be reaching into your gmail acount.

Oh, my mistake then it might be a problem with arduino.

[quote author=The Clever Monkey link=topic=105003.msg787550#msg787550 date=1336495077] Try sharing the images directly. Those URLs seem to be reaching into your gmail acount. [/quote] Done!

Well, first of all, the second photo seems to show the LED leads and both wires connected to the same conductor on the breadboard. That can’t be right, but I can’t quite tell from the photo. I’m assuming this is a “normal” breadboard, where the power rails run the length and the DIP rails run the the half-width.

Also, the VIN pin doesn’t do anything when you are powering by USB. It is a voltage reference when the power source is not USB (or is a power source itself.) Either way, it isn’t going to work. You’d need to go from LED positive on pin 9 to LED negative on the GND pin (through a resistor so you don’t turn your Uno into a toaster – it’s a good habit.)

The first example connects across two PWM ports. That’s not right, either.

Try this one, but use port 12: http://arduino.cc/en/Tutorial/BlinkWithoutDelay

(I say pin 12 only because it is closer to the GND pin. You can use PWM 9 for this sketch, because you are configuring it as a digital out. You should also use a resistor to limit the current draw.)

And see here: http://arduino.cc/en/Tutorial/DigitalPins

Oh, and it matters how the LED is connected. The lead on the side with the flat edge connects to ground (GND) usually. If it doesn’t work, try switching it around.