Alternating Blink Program

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).

Also, I have connected the long end of the diodes (anode I think) with the resistance and the short end to ground.

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.

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?

wiring2.jpg

Luk_11:
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?

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.

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.

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...

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.. :slight_smile: