Test Result - Keyestudio Ks0428 Manual

Table of Contents

Advertisement

www.keyestudio.com
delayMicroseconds(pulsewidth);
digitalWrite(servoPin,LOW);
delay((20 - pulsewidth / 1000));
}}
//The function to control ultrasonic sensor function controlling
ultrasonic
float checkdistance() {
digitalWrite(Trig, LOW);
delayMicroseconds(2);
digitalWrite(Trig, HIGH);
delayMicroseconds(10);
digitalWrite(Trig, LOW);
float distance = pulseIn(Echo, HIGH) / 58.20;
2*29.1=58.2
delay(10);
return distance;
}
//****************************************************************

(5) Test Result

Upload code successfully, DIP switch is dialed to right end, the
servo rotates to 90°, "V" is shown on 8X16 LED panel and smart
car moves as the obstacle moves.
//58.20, that is ,
192

Advertisement

Table of Contents
loading

Table of Contents