Data Sheet
digitalWrite(TriggerPin, LOW); //Turn on reading mode for the RS485 interface
managerTimer = 10;
break;
default:
readingStep = 0; // Finish reading the distance and start a new measuring for the sensor
break;
}
if(readingStep < 2) readingStep++; //step manager
else readingStep = 0;
timer = millis();
}
}
/********************* Transmit Command via the RS485 interface ***************/
void urmTrigger(int id){ // The function is used to trigger the measuring
cmdst[2] = id;
cmdst[3] = 0x00;
cmdst[4] = 0x01;
transmitCommands();
// SerialPort.println("Trigger!");
}
void urmReader(int id){ // The function is used to read the distance
cmdst[2] = id;
cmdst[3]=0x00;
cmdst[4]=0x02;
transmitCommands();
// SerialPort.println("Ask for distance!");
}
void transmitCommands(){ // Send protocol via RS485 interface
cmdst[5]=cmdst[0]+cmdst[1]+cmdst[2]+cmdst[3]+cmdst[4];
delay(1);
for(int j = 0; j < 6; j++){
printByte(cmdst[j]);
// delayMicroseconds(10);
}
delay(2);
}
/********************* Receive the data and get the distance value from the RS485 interface
***************/
void decodeURM4(){