OK, are you trying to do a LED project like the simple blink http://arduino.cc/en/Tutorial/Blink.
If so you would go from pin 7 to LED and resistor then to ground. The 5V pin is not used as the 5V is supplied to LED on pin 7 HIGH.
So you would not tie the LED to 5V pin of the Arduino.
If I understand your setup, the LED will light by pin 7 low as the 5V is powering the LED to pin 7.
This puts 5v using what ever resistance pin 7 has as the current limiting, this could cause over current on pin 7 and the LED.
When with your wiring pin 7 is high it has almost 5V on it and so you have 5V on both anode and cathode so no LED light.
The way the LED works high for off and low for on is correct for how you have it wired up. This is called current sinking and is the normal professional way of lighting LEDs. Beginners do not like this and so use current sourcing where a high turns the LED on.
However that resistor is doing nothing, it is not in the circuit, remove it and it works just the same. You are letting too much current flow through the Arduino pin and damaging it. Please put the resistor in line with the LED, that is between the LED and the output pin. Connect nothing to ground.
The way your LED is wired up is such that if you disconnect pin 7 or the Arduino from the LED it will light all the time. When you drive pin 7 high, that puts the cathode voltage at 5V which is the same as the anode voltage so it has no voltage across it and will not light. When you drive pin 7 low, the LED then has 5V across it and will light (and as noted above, will damage both the LED and the Arduino).
If you want to wire up the arduino to an LED so that it lights on a high, then go from pin 7 to the anode of the LED and then have a 220 or 330 Ohm resistor from the cathode to ground.
If, later on you decide that you would like an inverting light (which is what you have now) connect the resistor to +5V, and the other end to the LED anode, and connect the LED cathode to pin 7. That way you current limit the LED and it will only light when pin 7 is low.
Thanks guys, my current set up is like in the circuit diagram posted by spicetraders. weird that it wouldn't work because all my push buttons are on a similar circuit as well.
I will try the TomGeorge way now.
so to sum it up, ground --> resistors --> -ve or short end of the led --> +ve or long end of the led --> pin 7
would that make it work better.
the way i have it set up right now seemed more intuitive for some reason. going to try it now.
I am using diagram one for the switches so I think i am good.
this might need a separate thread but I am having a problem with the same project.
all the pins are working fine except for some reason pins 53 and 51 randomly turn to the high state. the only way to fix this problem is to get rid of the loop for push buttons on pins 53 and 51.
The code is exactly the same as for other pins so not sure whats going on.
Note that pins 53 and 51 are used for SPI on the Mega ... try using other available pins.
If your using pulldown resistors, make sure the pinmode is INPUT, not INPUT_PULLUP.
rm65453:
I am using diagram one for the switches so I think i am good.
No, it is not really good.
Diagram three is the preferred version because it is in general not a good idea to have the 5V line itself going to any component that it does not need to and especially where that involves going to external wiring - as may often be the case with switches or sensors - due to the consequences of an accidental short to ground. If a switch or sensor line is shorted to ground where it switches to ground anyway, the worst that happens is a spurious input.
This point of efficient design is precisely why input pull-ups are provided in the MCU and not pull-downs.
rm65453:
I thought they were just normal digital communication pins.
They are. But if you use the SPI at all, those are the pins you use, paralleled to the ICSP/ SPI header.