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 =(
And make sure you are not using Digital 0 and 1. They are "occupied".
And make a test code. A simple multi blink, like :
// 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);
}
}
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.
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.
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
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