tedo3637:
Okay,@dindibo4 can you tell me a method to make this, i need to create a small device(with not constant position) and i want to get position of this device.Let me sketch, if we have 1 square flat surface and we set non-constant point in this square, we need to get position of this, and the connection from device and surface is wireless
Alright, if you want to measure a distance between a sensor and something else that is standing in front of the sensor I would recommend you using an active sonar that as I said it can be made easily with the HC-SR04,
It's a cheap sonar module that you can connect to the arduino.
It works a bit different than what you described, how it works is by sending an ultra-sonic soundwave which is above 20KHz and you cannot hear that and when it collides with something it bounces off the object and then goes back to a microphone that can detect this Ultrasonic sound.
The equation for this method is a bit different than the other equation, it's d = (v*t) / 2, the speed of sound, in that case, is 340.29 m/s at sea level and you divide all by 2 because the sound wave has to go from the sensor to the object and from the object to the sensor.
You can use this sketch
pin 2 - Is the pin that turns from LOW to HIGH as soon as the sound wave received.
pin 4 - The trigger pin the one that you control the speaker with and when it turns to HIGH it send the sound wave.
But if I understood you correctly you want to know the position of the device(the arduino board), if so that's something completely different, you would need a GPS module.
If you wanna know more about the sensors they called:
HC-SR04 which is the sonar module.
and the NEO-7M, which is a relatively cheap GPS module that compatible with the arduino.
