I want to have my servo motor rotate a certain amount for each distance it gets on the ultrasonic sensor till it reaches 180 after a certain distance. So for example if I want the max to be 50 cm I want it to be at the halfway mark of 90 at 25 cm and in-between each degree for each distance till 50. I was told the best way to do this is the map function but don't really know how to start and get the map function to work
i just looked at the tutorials section. Perhaps the general problem is: the first post does not tell people what a "tutorial" actually is. so the innocence do not know not to post.
Paul
ok ill look into that more and try and figure that out. I also wonder if this code I found on another forum site post about a similar question would work if I change a few things around
val=analog.read (potpin); // read the pot
if(pin10==HIGH) // pin 10 selects servo range
val=map(val,0,1023,0,180); // map the pot value ...
else // into one of
val=map(0,1023,0,90); // the servo ranges
servowrite(val);