Connecting a servo to a sharp range finder

Hi all, I'm new to this.

I'm looking to be able to control a servo with a sharp range finder. However I don't understand mapping, or even how to set the circuit up.

Can anyone help me?!

Show us your code, and we'll do our best.

This is the very small amount I have been able to put together so far.

#include <Servo.h>

Servo myservo;

int SRF = 0;
int val;

void setup()

void loop()
val = analogRead(SRF);
val = map(val, 3, 1023, 0.3, 179);

map doesn't operate on floating point numbers, so your 0.3 becomes zero.
What else is the problem?

Honestly, I don't know what I'm doing. :~
How would I go about setting it up so worked? the idea being that the servo would turn 180 degrees with the extremes in proximity, and obviously the in between values as well.

The first thing I'd do would be to ignore the servo completely - that bit is easy.
Second, add some debug prints to find the range of values you get back from the sensor.