DFRobot ROB0117 빠른 시작 매뉴얼 - 페이지 10
{카테고리_이름} DFRobot ROB0117에 대한 빠른 시작 매뉴얼을 온라인으로 검색하거나 PDF를 다운로드하세요. DFRobot ROB0117 13 페이지. Basic kit for cherokey 4wd
2015/11/4
}
void SensorSetup(){
pinMode(URTRIG,OUTPUT);
digitalWrite(URTRIG,HIGH);
pinMode(URPWM, INPUT);
for(int i=0;i<4;i++){
Serial.write(EnPwmCmd[i]);
}
}
int MeasureDistance(){
digitalWrite(URTRIG, LOW);
digitalWrite(URTRIG, HIGH);
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);
}
if(pos>119) sweepFlag = false;
}else {
if(pos>=60 && pos<=120){
pos=pos-1;
myservo.write(pos);
}
if(pos<61) sweepFlag = true;
}
}
STEP 5: Debugging Robot
1. Fix the upper Plate
https://www.dfrobot.com/wiki/index.php?title=Basic_Kit_for_Cherokey_4WD_SKU:ROB0117
Basic Kit for Cherokey 4WD SKU:ROB0117 - Robot Wiki
// A low pull on pin COMP/TRIG
// Set to HIGH
// Sending Enable PWM mode command
// a low pull on pin COMP/TRIG triggering a sensor reading
// reading Pin PWM will output pulses
// the reading is invalid.
// every 50us low level stands for 1cm
// in steps of 1 degree
// tell servo to go to position in variable 'pos'
// assign the variable again
10/13