Servo86.stop()

[Servo86]

Description

Stops the servo rotation.

When you call this function, the servo will stop at the current position immediately. The behavior of this function is different from pause(), you cannot resume the servo by resume(), you must reset the target position and call run(), or call write() or writeMicroseconds() to make the servo rotate again.

Please note that the servo will still produce power when it is stopped, so please do not turn the servo by hand, otherwise the servo will be damaged.

Syntax

servo.stop()

Parameters

servo: Variable of the servo type.

Returns

None.

Example

#include <Servo86.h>
 
Servo myservo;
 
void setup()
{
   myservo.attach(9);
   myservo.write(1500); // turn the servo to the initial position of 1500us
   myservo.run(); // start the servo
   delay(100);
 
   myservo.setPosition(1800, 3000); // Set the target angle of the servo: 1800us, time: 3 seconds
   myservo.run();
   delay(2000); // make the servo spin for 2 seconds
   myservo.stop(); // stop the servo
}
 
void loop() {}

See also


Libraries Reference Home

The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Leave a Comment

Scroll to Top