Problem wiring a sensor to give a signal.

I am having problems not knowing how to wire a sensor, or a phototransistor to analog imput to give me a signal which I would use to play a tune from a speaker. I already have a program which allows me to play that tune, and I have to press a button to play it again. Instead, I would like to get a signal from a phototransistor or proximity sensor that would work same as pressing that button.

I am, however having problems wiring it and also in writting a right program. I already searched on Google. I can't seem to find a right program for it to work.

I wired it like it says on Google, but it doesen't work. If I could at least turn ON and OFF a LED diode just by phototransistor. What should my program look like?

Ovca:
I wired it like it says on Google, but it doesen't work. If I could at least turn ON and OFF a LED diode just by phototransistor. What should my program look like?

Did you find this one on Google?

A program for that would be this, since you are reading an analog voltage just like from the pot.