Go Down

Topic: SOLVED Please help: Pins are not functioning! (Read 754 times) previous topic - next topic

blanclait

Mar 17, 2012, 10:42 pm Last Edit: Mar 18, 2012, 01:25 am by blanclait Reason: 1
Hello, I've been following some learning tutorials from a book and I've been stuck on this part for days.

I don't know why, but my pins from 1-11 don't work. As you can see from the picture below, it fails to light up the LED. I checked all the wires, resistors and LEDs with the working pins (12, and 0) and they function perfectly fine.  

All these devices are brand new, so I doubt it is the arduino uno or the breadboard's fault.

Any help would be SOOO wonderful! This is giving me quite the headache  =(


kd7eir

Can you please post the code that you are using?

spycatcher2k

Check things first -
Make sure all outputs are HIGH.
swap a working led/resistor to the faulty led position, move the layout to other rows on the breadboard (Been caught by this myself on more than 1 occasion)
Make a 'tester' by using 1 resistor(220Ohm to 440Ohm) and 1 led, and wire.

connect them       ----------resistor-------(+ LED -)----------wire
connect the wire to GND on the arduino
pop the other end into the output you want to test
digitalWrite(pin,HIGH);
if it lights - the output is working
try each one in turn
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

Techone

And make sure you are not using Digital 0 and 1. They are "occupied".

And make a test code. A simple multi blink, like :

Code: [Select]

// check all digital pins except pin 1 and 0
// Those a reserved pins for Com link

const byte the_pins[12] = {13,12,11,10,9,8,7,6,5,4,3,2};

void setup()
{               
  for (int i=0;i<12;i++)
  {
    pinMode(the_pins, OUTPUT);
    digitalWrite(the_pins, LOW);
  }   
}

void loop()
{
  for (int i=0;i<12;i++)
  {
    digitalWrite(the_pins, HIGH);
    delay(1000);
    digitalWrite(the_pins, LOW);
  } 
}

AWOL

#4
Mar 17, 2012, 11:38 pm Last Edit: Mar 17, 2012, 11:42 pm by AWOL Reason: 1
But unlike that example, make sure you put a delay after turning the pin LOW in the for loop, otherwise you might think your LED isn't turning off
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

BillO

If you can just move one of those yellow wires from say, pin 11 of the Arduino, to pin 12, make the appropriate change to the program and it works, then it must be the Uno or the Atmega328 on it.
Facts just don't care if you ignore them.

woody_unreal

yes check your connections, it almost looks like from your pict that the breadboad has the connections in the incorrect place.

blanclait

my apologies. This is the code given in the book.
It uses pin 10,11 & 12.
it is suppose to be some kind of binary dice.

Quote

const unsigned int LED_BIT0 = 12;
const unsigned int LED_BIT1 = 11;
const unsigned int LED_BIT2 = 10;

void setup() {
 pinMode(LED_BIT0, OUTPUT);
 pinMode(LED_BIT1, OUTPUT);
 pinMode(LED_BIT2, OUTPUT);
 
 randomSeed(analogRead(A0));
 long result = random(1,7);
 output_result(result);
}

void loop() {
}

void output_result(const long result) {
 digitalWrite(LED_BIT0, result & B001);
 digitalWrite(LED_BIT0, result & B010);
 digitalWrite(LED_BIT0, result & B100);
}



@spycatcher
I tried moving the rows and they have been tested separately. Though I can't be sure about breadboard and arduino uno, as far as the wires, led and resistors go, they all are working.
Probem is that the pin 1-10 isn't feeding anything to the led. Idk why.

@woody
connection is done like this
Pin 12 -> row 3, which has both sides of resistor, followed by positive of the LED.
row 4, has negative of the LED which is followed by short wire connecting to the negative of the breadboard.

At the end, the blue wire connects from negative of the breadboard to the Ground.

woody_unreal

might try something goofy, just connect say pin 10 to resistor to led to ground ,, without using the breadboard or even use pin 13 tempararly just to check the setup :) see what results .

retrolefty

Why the const in the statement void output_result(const long result) {

That doesn't look right. And calling two different variable the same name 'result' is misleading.

Lefty


spycatcher2k

If the wires are in the correct place, the resistors are the correct values, the LEDs are in the correct orientation, then it should work - You have tested the outputs - they work, you have tested the resistors and LEDs individually - they work. The only common factor left is human error! - When I come up against similar situations - I take out all the wires, resistors and LEDs. and start again, but one at a time - pin 10 -> resistor -> led Anode : led Cathode - GND . . . . . . . then do the same for 11 then 12  Hopefully that will get to the bottom of it.
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

blanclait


Why the const in the statement void output_result(const long result) {

That doesn't look right. And calling two different variable the same name 'result' is misleading.

Lefty




My gosh. Yes there was indeed a problem with the script name. Thank you!!

And Thank you for everyone who posted. All of you have been a great help in either solving the problem or learning a trick or two about arduino. Thank you all  :smiley-mr-green:

Go Up