Go Down

Topic: only pin 13 Works (Read 1 time) previous topic - next topic

Brad Jouty

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.

tweedius

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?

Brad Jouty

Code: [Select]
/*
 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
}

Brad Jouty

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

tweedius

#4
Dec 28, 2010, 02:07 am Last Edit: Dec 28, 2010, 02:23 am by tweedius Reason: 1
Code: [Select]
/*
 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 :P  

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.

Go Up