Keywish Hummer-Bot-2.0 Instruction Manual page 30

Table of Contents

Advertisement

digitalWrite(ServoPin, HIGH);
delayMicroseconds(pulsewidth);
width value
digitalWrite(ServoPin, LOW);
delayMicroseconds(20000
}
delay(1000);
}
void
loop()
{
while
(Serial.available() > 0)
{
inByte
=
Serial.read();//Read data, the serial port can only read 1 character
temp
+=
inByte;//The characters read into temporary variables inside the cache,
//Continue to determine the serial port there is no data, know all the data read
out
}
// Determine whether the temporary variable is empty
if
(temp
!= "") {
angle
= temp.toInt();
Serial.print("Servo degree:
SetServoDegree(angle);
}
temp
=
"";//Please see temporary variables
delay(100);//Delayed 100 milliseconds
}
Figure 3.1.25 Schematic diagram of rudder wing and ultrasonic bracket installation
//Set the servo interface level to high
//The number of microseconds of the delay pulse
//Set the servo interface level to low
- pulsewidth);
//Determine whether the serial data
//Convert variable string type to integer
");
//Control the servo to rotate the corresponding angle.
27

Advertisement

Table of Contents
loading

Related Products for Keywish Hummer-Bot-2.0

Table of Contents