Reading a Ping))) to a DC Motor

Hi all,
First off, I'm relatively new to arduino and the forums.

My first project is a talking snake I'm creating for my school. One of the main hopefuls of the snake is to use a Ping))) Distance sensor to adjust the amount of power that a DC Vibrator motor (Acting as a rattler) is recieving. So basically, the closer you get to it, the faster the motor spins.

I've got my code so that my Uno reads from the Ping, into the arduino, and maps the inches into a value between 0-255 that can be output into my motor. The only problem is, all of the readings that I'm getting from my map function are negative values. Here's the section of code that I'm having trouble with:

inches = microsecondsToInches(duration);
  
 int motorSpeed = map(inches,8,0,0,255);
 analogWrite(motorPin, motorSpeed);
  
  Serial.print(inches);
  Serial.print("inches, ");
  Serial.print("Motor Speed:");
  Serial.print(motorSpeed);
  Serial.println();

In my Serial Monitor, I'm getting lines that read stuff like "10 inches, Motor Speed: -63". I know that my motor cannot read negative values, and I'm confused why my map function is giving me readings like that.

All suggestions and help are greatly apreciated! Thanks!

add an "constrain" to force inches within range