Trouble with LED response to Sensor

Hello! I'm not sure if this should be in here or in Sensor forum, so I'm cross-posting.

I'm trying to create the following project:

And having trouble with getting the LED to react correctly. It should be getting gradually brighter as the distance between it and objects lessens, but instead it is operating the opposite way and flickering or turning on or off instead of changing smoothly.

I'm at a pretty beginner level, so this might be something simple I just need to think about more, but I'm hoping to have this finished/understood ASAP so I can modify it a little.

Any help is greatly appreciated!

PICS: Ultrasonic Sensor Distance Based LED - Album on Imgur

@kassha, do not cross-post. Other thread removed.

Delta_G:
You didn't think either of those things were important enough to post so there's not much anyone can do to help you.

Instead of two useless posts, you should have just made one good post.

I included a link to both the code I'm using and photos of my wiring.

Instead of a rude and useless reply, you could have just decided you didn't feel like clicking on the links to investigate and moved on to a topic that was more interesting to you.

But thanks!

Sorry mod, I did look over the rules briefly but missed that-- thanks for the reminder.

kassha:
Instead of a rude and useless reply, you could have just...

No, it is you that is being rude to us. You say you glanced over the forum guidelines, but clearly decided to ignore all of them. Cross-posting, not posting code, links or images correctly... you broke almost every rule in there. Mend your ways or no-one will help you mend your project.

I'm at a pretty beginner level,

Then you need to know that almost all instructables posts are below that and are crap and should not be followed unless you know more than tha author and can spot his mistakes.

I say his because I feel only a man would have such an overinflated view of his own ability. Not all men but enough.

Just post your code so WE ALL can help.

I'm going to go crazy with what people broke these days.