DFRobot ROB0118 Podręcznik - Strona 8

Przeglądaj online lub pobierz pdf Podręcznik dla Robotyka DFRobot ROB0118. DFRobot ROB0118 13 stron.

}
}
void SensorSetup(){
pinMode(URTRIG,OUTPUT);
digitalWrite(URTRIG,HIGH);
pinMode(URPWM, INPUT);
and
for(int i=0;i<4;i++){
Serial.write(EnPwmCmd[i]);
}
}
int MeasureDistance(){
nsor reading
digitalWrite(URTRIG, LOW);
digitalWrite(URTRIG, HIGH);
pulses
unsigned long distance=pulseIn(URPWM,LOW);
if(distance==50000){
Serial.print("Invalid");
}else{
distance=distance/50;
}
return distance;
}
void servoSweep(){
if(sweepFlag ){
if(pos>=60 && pos<=120){
pos=pos+1;
myservo.write(pos);
sition in variable 'pos'
}
// A low pull on pin COMP/TRIG
// Set to HIGH
// Sending Enable PWM mode comm
// a low pull on pin COMP/TRIG
// reading Pin PWM will output
// the reading is invalid.
// every 50us low level stands for 1cm
triggering a se
// in steps of 1 degree
// tell servo to go to po