I want to find...

Search

Shares

Table of Content

Servo86.readMicroseconds()

[Servo86]

Description

Read the current angle of the servo.

Syntax

servo.readMicroseconds()

Parameters

servo: Variable of the servo type.

Returns

The current angle of the servo (type unsigned long integer), if the servo is not yet out, the return value is 0. (Unit: us)

Example

#include <Servo86.h>
 
Servo myservo;
unsigned long position;
 
void setup()
{
   myservo.attach(9);
   myservo.write(90.0); // make the servo go 90 degrees
   delay(100); // delay 100 ms
   position = myservo.readMicroseconds(); // read the current angle
   Serial.println(position);
}
 
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