attiny 85 and the ping sensor

example code for the ping sensor from the sr04 ping device ) i found a better example im not sure where its from or who to thank it was on a google page but threw trial and eror this is what was able modified to my needs seems to be working ok with out the pwm pin im assuming it will just have a slower response time on the ping

/*
 HC-SR04 Ping distance sensor]
 VCC to arduino 5v GND to arduino GND
 Echo to Arduino pin 13 Trig to Arduino pin 12
 More info at: http://goo.gl/kJ8Gl
 */
#define trigPin PB2 // changed these to match pins that the attiny 85 has
#define echoPin PB1

int rpm = PB0; // pwm pin out to transistor to control motor and colors
int Val; //  used to map value to 255 
void setup() {

  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(rpm, OUTPUT); 
}

void loop() {
  long duration, distance;
  digitalWrite(trigPin, LOW);  // Added this line
  delayMicroseconds(2); // Added this line

  digitalWrite(trigPin, HIGH);
  //  delayMicroseconds(1000); - Removed this line
  
  delayMicroseconds(10); // Added this line
  
  digitalWrite(trigPin, LOW);
  
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
  
  
  
  if (distance >= 65 || distance <= 0){

    analogWrite(rpm, 0); // stop all motion and colors on leds result hall way night light dose not keep me a wake with flash 
                                 // in till it see me in range used a ping sensor as a motion detector in short
  }
  else {


     analogWrite(5,distance/4);
     
     Val = map(distance, 65, 1, 0, 80);
     analogWrite(rpm, Val);
     
     
    
  }
  
  
  
  
  
  delay(1);
}