Easy Problem

Hello,

I bought Arduino Mega 2560 card, and I have a problem when I want to do flash a LED, the LED doesn't flash, it doesn't work.
The code:

int ledPin = 51;

void setup()
{
pinMode(ledPin, OUTPUT);
}

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

Thanks for yours answers :wink:

and I have a problem when I want to do flash a LED.

But you are not going to tell us what that problem actually is.

There is nothing wrong with that code, so it must be your wiring.

He sounds like he's incredibly new. My betting is either:

  • He didn't put a resistor in series with the LED, and LED is now burned out
  • LED is backwards - LEDs are polarized, and if connected backwards, they won't light.
  • Connections are loose.

This isn't a problem of connections or LED because I tested it with a 5V cell, and it worked.

AlexandreCool:
This isn't a problem of connections or LED because I tested it with a 5V cell, and it worked.

But you still don't say what the problem is. That seems like pretty important information if you want help with it.

The problem is that nothing happen when I start the programm (this one has been well transfer)

Is the LED connected the right way around?

When you tested it with 5v, did you have a resistor in series with it? Do you have one in series with it now? Using an LED without a series resistor can easily burn out an LED. I had one fail get trashed because of noise on the voltage adjust knob of the power supply as I was slowly cranking the voltage up... I had it at the right voltage, but as I removed my hand, it edged up 0.1v and the LED got real bright for a split second and then failed.

Are the connections secure? Try wiggling the wires, make sure they're not loose. Sometimes cheap clone arduinos and cheap crappy male dupont jumpers don't make a reliable connection.