Mótar Servo#
Réamhrá#
Úsáidtear an rang servo servo chun Mótar Servo 3-Sreang V5 a rialú agus a chumrú. Soláthraíonn an Mótar Servo 3-Sreang V5 rialú bunaithe ar shuíomh laistigh de raon gluaiseachta socraithe.

Tógálaithe Ranga#
servo( triport::port& port );
Scriostóir Ranga#
Scriosann sé an réad servo agus scaoileann sé acmhainní gaolmhara.
~servo();
Paraiméadair#
Paraiméadar |
Cineál |
Cur síos |
|---|---|---|
|
|
An Port 3-Sreang a bhfuil an Mótar Servo ceangailte leis, scríofa mar |
Nótaí#
Ní mór Brain nó Leathnaitheoir 3-Sreang a chruthú ar dtús sula bhféadfar iad a úsáid chun réad a chruthú leis an tógálaí ranga
servo.
Sampla#
// Create the servo instance on 3-Wire Port A
servo myServo = servo(Brain.ThreeWirePort.A);
Feidhmeanna na mBall#
Áirítear leis an rang servo na feidhmeanna ball seo a leanas:
setPosition— Bogann sé an mótar servo go suíomh sonraithe.
Sula nglaotar ar aon fheidhmeanna servo , ní mór sampla servo a chruthú, mar a thaispeántar thíos:
/* This constructor is required when using VS Code.
Servo configuration is generated automatically
in VEXcode using the Device Menu. Replace the values
as needed. */
// Create the servo instance on 3-Wire Port A
servo myServo = servo(Brain.ThreeWirePort.A);
setPosition#
Bogann sé an mótar servo go suíomh sonraithe.

1 — Socraíonn sé suíomh an servo ag baint úsáide as luach céatadáin.
void setPosition( int32_t value, percentUnits units );
Parameters2 — Socraíonn sé suíomh an servo ag baint úsáide as aonaid rothlaithe.
void setPosition( double value, rotationUnits units );
Paraiméadar |
Cineál |
Cur síos |
|---|---|---|
|
|
Luach suíomh an servo agus aonaid chéatadáin in úsáid. |
|
|
Luach suíomh an servo agus aonaid rothlaithe á n-úsáid. |
|
|
An t-aonad suímh: |
|
|
An t-aonad suímh:
|
Ní thugann an fheidhm seo luach ar ais.
NotesAgus aonaid chéatadáin in úsáid, is é an raon bailí ná 0 – 100%.
Tosaíonn servo gach tionscadal trína lárú go huathoibríoch ag 50 céim sula gcríochnaíonn sé aon ghluaiseachtaí.
Agus aonaid rothlaithe á n-úsáid, bogfaidh an servo go dtí an suíomh absalóideach atá sonraithe.
// Set the servo position to 10 percent
myServo.setPosition(10, percent);
// Set the servo position to 45.5 degrees
myServo.setPosition(45.5, degrees);
// Set the servo position to 90 degrees
myServo.setPosition(90, degrees);