Long range proximity sensor that triggers mp3 files?

Hey all,

Just starting to work with proximity sensors (Infrared Proximity Sensor Long Range - Sharp GP2Y0A02YK0F) and hoping to connect it via arduino (Im hoping a lilypad arduino? Not sure if the 5v requirments can be processed by lilypad?).
Anyway, Id like to create something that, when you are farther away, you hear say, "Track 1", then move closer and you hear "Track 2" etc.
How difficult would that be?
I have just this basic code for the prox sensor here:

int sensorPin = 0; //analog pin 0

void setup(){

void loop(){
int val = analogRead(sensorPin);

//just to slow down the output - remove if trying to catch an object passing by

and am wondering how to combine the calibrations of the proximity sensor to the mp3 files being triggered.
Thanks in advance to all you knowledgeable folks out there!

use "if statements" to determine which track to play based on your analog input reading

For longer-distance measurements you probably want an Ultrasonic ranging device. See:


I have some of these here:

DISCLAIMER: I mentioned stuff from my own Shop...

Thanks guys!

I guess I shouldnt say long range, it will only be from about 10ft away?

I guess I shouldnt say long range, it will only be from about 10ft away?

That is long range… Short range is up to about 500mm, long range is up to about 0.5m-4m or so (approximate limits of standard ultra-sonic range sensors).

The code is easy enough with ‘if statements’.

long range proximity

That's a oxymoron, isn't it?

You know, like "military intelligence"