Arduino Forum

Using Arduino => General Electronics => Topic started by: Luk_11 on Dec 04, 2017, 06:58 pm

Title: Alternating Blink Program
Post by: Luk_11 on Dec 04, 2017, 06:58 pm
Okay, so I am trying to modify the example Blink program just a tiny little bit. Here's my program code:

const int LED1 = 10;
const int LED2 = 11;

void setup(){
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
}

void loop() {
 digitalWrite(LED1, HIGH);
 digitalWrite(LED2, LOW);
 delay(1000);
 digitalWrite(LED1, LOW);
 digitalWrite(LED2, HIGH);
 delay(1000);
}

The code should be correct, at least I don't get an error message. But something must be wrong with my wiring, since nothing happens (see attachments).  I hope you can see what's going on in the picture: The two resistances are not on the same rail. As far as I know, the breadboard is internalle connected along a vertical line but not horizontally. So I really don't know why this is wrong. 

Can anyone please help me out ? ( I know probably a really stupid question).

Title: Re: Alternating Blink Program
Post by: Luk_11 on Dec 04, 2017, 07:10 pm
Also, I have connected the long end of the diodes (anode I think) with the resistance and the short end to ground.
Title: Re: Alternating Blink Program
Post by: aarg on Dec 04, 2017, 07:12 pm
Everything is wrong with your wiring. Most of the wires connect to nothing at all. Have you looked at which pins are common on the breadboard?

It would behoove you to draw a proper schematic and show an image here so we can see directly how you are trying to implement this. Actually, it should have been your first step.
Title: Re: Alternating Blink Program
Post by: Luk_11 on Dec 04, 2017, 10:51 pm
hey, thx for your answer!

What do you mean by "have you looked at which pins are common on the breadboard?"

Anyways, I think I missunderstood the breadboard: it seems only the outermost two columns are connected vertically and the ones in the middle are connected horizontally. So I corrected my wiring and it is still wrong. I am trying to implement the sketch that you can see in the attachements as well. This is a sketch for the Arduino Uno and I am trying to implement it on the Mega2560, but it shouldn't be of any difference now, should it?
Title: Re: Alternating Blink Program
Post by: MarkT on Dec 05, 2017, 11:55 am
hey, thx for your answer!

What do you mean by "have you looked at which pins are common on the breadboard?"
It means do you know how the breadboard works?

Quote
Anyways, I think I missunderstood the breadboard: it seems only the outermost two columns are connected vertically and the ones in the middle are connected horizontally.
You just figured out how a breadboard works.

Quote
So I corrected my wiring and it is still wrong. I am trying to implement the sketch that you can see in the attachements as well. This is a sketch for the Arduino Uno and I am trying to implement it on the Mega2560, but it shouldn't be of any difference now, should it?
First check that you can light the LED from the +5V pin via resistor, get that working first, then
connect resistor to the Arduino pin.  Post your code (in code tags) if its changed.
Title: Re: Alternating Blink Program
Post by: tkbyd on Dec 05, 2017, 05:58 pm
For others folloing this thread who aren't "old hands" with breadboards... which are worth their weight in gold, by the way, and come in many shapes and sizes... see...

https://computers.tutsplus.com/tutorials/how-to-use-a-breadboard-and-build-a-led-circuit--mac-54746 (https://computers.tutsplus.com/tutorials/how-to-use-a-breadboard-and-build-a-led-circuit--mac-54746)
Title: Re: Alternating Blink Program
Post by: TomGeorge on Dec 06, 2017, 01:07 pm
Hi,
Do you have a DMM?

Are you sure your resistors are 470R?

If you lift the wire out of pin10 and connect it to a 5V pin, does the LED light?
This way you are applying 5V to the LED through the resistor.

Try the same with the pin11 wire?

Tom.. :)