noob needing help with sensor build

im tryingo build a ir obstacle sensor using ir led and transistor i got from radio shack i tryed hooking tham up so the transistor whant right to a pin and than did a analog read and got 1023 all the time and than tryd digital read and got all 0 please help this pore noob

Did you add a pull-down (or pull-up) resistor as well as the phototransistor?

Like this:

Imgur

Can you post a circuit diagram of how you wired up your Arduino?

yes i tryed that and just tryed it again only got 0 this time using the basics analog readto serial

i build it like in this video except no idea whatthe code is

little update tryed hooking it up again as the digram from above showed using a higher resistor now analog read shows 666 to 667 whan left alone and whan very close with hand shows 665 to 664 hmm its something but how to get a little more diffence in readings