URM37 V3.2 - Uno R3 (Sync Problem)

I want to measure distance with the URM37 V3.2 to a UNO R3

I followed the instructions on:
http://milesburton.com/URM37_Ultrasonic_Distance_Measurement_Library

What i get is:
avrdude: stk500_getsync(): not in sync: resp=0x00

Also i get some random feedback:
DDistance=12834""Distance=12834""Distance=12834""Distance=12834""Distance=13090""""Distance=-256""Distance=-11""

/* Ultrasound Sensor
*------------------
* URM V3.2 ultrasonic sensor TTL connection with Arduino
* Reads values (0-300) from an ultrasound sensor (3m sensor)
* and writes the values to the serialport.
* Pin12 (Arduino)-> Pin 1 VCC (URM V3.2)
* GND (Arduino) -> Pin 2 GND (URM V3.2)
* Pin11 (Arduino) -> Pin 7 (URM V3.2)
* Pin 0 (Arduino) -> Pin 9 (URM V3.2)
* Pin 1 (Arduino) -> Pin 8 (URM V3.2)
* www.yerobot.com
* Last modified 20/04/2009
*/

int UREnable = 11; // Ultrasound enable pin
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
int ledPin = 13; // LED connected to digital pin 13
boolean flag=true;
uint8_t DMcmd[4] = { 0x22, 0x00, 0x00, 0x22}; //distance measure command

void setup() {
  Serial.begin(9600);                  // Sets the baud rate to 9600
  pinMode(ledPin, OUTPUT);            // Sets the digital pin as output
   pinMode(UREnable, OUTPUT);
   digitalWrite(UREnable, HIGH); // Set to High
    pinMode(URPower, OUTPUT);
   digitalWrite(URPower, HIGH); // Set to High

delay(200); //Give sensor some time to start up --Added By crystal  from Singapo, Thanks Crystal.
}

void loop()
{
 
  flag=true;
  //Sending distance measure command :  0x22, 0x00, 0x00, 0x22 ;

  for(int i=0;i<4;i++)
  {
    Serial.write(DMcmd[i]);
  }
 
  delay(75); //delay for 75 ms
 
while(flag)
{
    if(Serial.available()>0)
    {
        int header=Serial.read(); //0x22
        int highbyte=Serial.read();
        int lowbyte=Serial.read();
        int sum=Serial.read();//sum
       
        if(highbyte==255)
        {
          USValue=65525;  //if highbyte =255 , the reading is invalid.
        }
        else
        {
          USValue = highbyte*255+lowbyte;
        }
   
       Serial.print("Distance=");
       Serial.print(USValue);
       Serial.print("/n");
       flag=false;
     }
}
  delay(50);
}

If any additional information is needed I'll gladly add it to the post. I have tried several different code-templates, but none seem to work. On the 'old' arduino everything works as aspected. What changes are made? There is also a significant difference between Arduino22 and Arduino 1.0. It looks like the new arduino SDK is not compatible with the Ultrason. Is this true?

I followed the instructions on:

which say to wire the thing to the hardware serial pins, which the IDE uses to upload code to the Arduino.

You need to pick two other pins, and use SoftwareSerial (with 1.0 or higher) or NewSoftSerial (0023 or prior) to communicate with it, or unplug it while uploading.

Try this, it works fine with my Arduino MEGA and SDK 1.0. You have to change the pins on the Arduino UNO to the corresponding.

/* Ultrasound Sensor
*------------------
* URM V3.2 ultrasonic sensor TTL connection with Arduino
* Reads values (0-300) from an ultrasound sensor (3m sensor)
* and writes the values to the serialport.
* Pin12 (Arduino)-> Pin 1 VCC (URM V3.2)
* GND (Arduino) -> Pin 2 GND (URM V3.2)
* Pin11 (Arduino) -> Pin 7 (URM V3.2)
* Pin 0 (Arduino) -> Pin 9 (URM V3.2)
* Pin 1 (Arduino) -> Pin 8 (URM V3.2)
* www.yerobot.com
* Last modified 20/04/2009
*/

int UREnable = 11; // Ultrasound enable pin
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int URRangeLow = 4000;
int URRangeHigh = 5000;
int timecount = 0; // Echo counter
int ledPin = 13; // LED connected to digital pin 13
boolean flag=true;
uint8_t DMcmd[4] = { 0x22, 0x00, 0x00, 0x22}; //distance measure command

void setup() {
  Serial.begin(9600);                  // Sets the baud rate to 9600
  pinMode(ledPin, OUTPUT);            // Sets the digital pin as output
   pinMode(UREnable, OUTPUT);
   digitalWrite(UREnable, HIGH); // Set to High
    pinMode(URPower, OUTPUT);
   digitalWrite(URPower, HIGH); // Set to High

delay(200); //Give sensor some time to start up --Added By crystal  from Singapo, Thanks Crystal.
}

void loop()
{
 
  flag=true;
  //Sending distance measure command :  0x22, 0x00, 0x00, 0x22 ;

  for(int i=0;i<4;i++)
  {
    Serial.write((byte)DMcmd[i]);
  }
 
  delay(75); //delay for 75 ms
 
while(flag)
{
    if(Serial.available()>0)
    {
        int header=Serial.read(); //0x22
        int highbyte=Serial.read();
        int lowbyte=Serial.read();
        int sum=Serial.read();//sum
       
        if(highbyte==255)
        {
          USValue=65525;  //if highbyte =255 , the reading is invalid.
        }
        else
        {
          USValue = highbyte*255+lowbyte;
        }
   
       Serial.print("Distance=");
       Serial.print(USValue);
       Serial.println(132, DEC);
       
       if((USValue > URRangeLow) && (USValue < URRangeHigh))
       {
          digitalWrite(13, HIGH);
       }
       else
       {
          digitalWrite(13, LOW); 
       }
       
       flag=false;
     }
}
  delay(50);
}

It is modified by me to light a LED in specific range of distance.

Regards,
loby

Thank you, it works!

Can't seem to get this working. I used the sketch in the post by Ioby. What I don't understand is why the 5V is not used.
It says Pin 12 to VCC (urm37): how does it get power?

Why wait 75 seconds?