ServoFrameKondo.capture()

[Servo86]

描述

Reads the current position of the specified KONDO servo.

KONDO’s RC servo provides a special function to return the current position. This function supports this function and can be used to read the actual position of KRS-786/788HV and KRS-4012/4014HV servos.

Notes on use.

Before calling this function, make sure that all servos are in the disengaged state before this function will work; if there are still servos in the disengaged state, call the release() function of the Servo class to disengage the servos first.

The signal line of KONDO servo needs to be connected to the lifting resistor so that 86Duino can read the position of its return. Please refer to the KONDO servo wiring example.

語法

myframe.capture(servo)

參數

  • myframe: the object of type ServoFrameKondo.
  • servo: the object of type Servo.

回傳

The current position of the KONDO servo return. If the reading fails, 0 is returned.

範例

#include <Servo86.h>
  
Servo myservo0;
Servo myservo1;
Servo myservo2;
ServoFrameKondo myframe;
 
void setup()
{
   myservo0.attach(9);
   myservo1.attach(11);
   myservo2.attach(5);
 
   // read the current position of myservo0, myservo1, myservo2
   myframe.positions[0] = myframe.capture(myservo0);
   myframe.positions[1] = myframe.capture(myservo1);
   myframe.positions[2] = myframe.capture(myservo2);
 
   Serial.println(myframe.positions[0]);
   Serial.println(myframe.positions[1]);
   Serial.println(myframe.positions[2]);
   myframe.save("captured_frame.txt");
}
 
void loop() {}

參考


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール