Extends
Methods
gotoAngle(angle, speedopt, interruptopt) → {Promise.<CommandFeedback>}
Rotate a motor by a given angle.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
angle |
number |
Absolute position the motor should go to (degrees from 0). |
||
speed |
number |
<optional> |
100 |
For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. |
interrupt |
boolean |
<optional> |
false |
If true, previous commands are discarded. |
- Inherited From:
- Source:
gotoRealZero(speedopt) → {Promise.<CommandFeedback>}
Rotate motor to real zero position.
Real zero is marked on Technic angular motors (SPIKE Prime). It is also available on Technic linear motors (Control+) but is unmarked.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
speed |
number |
<optional> |
100 |
Speed between 1 - 100. Note that this will always take the shortest path to zero. |
- Inherited From:
- Source:
resetZero(interruptopt) → {Promise.<CommandFeedback>}
Reset zero to current position
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
interrupt |
boolean |
<optional> |
false |
If true, previous commands are discarded. |
- Inherited From:
- Source:
rotateByDegrees(degrees, speedopt, interruptopt) → {Promise.<CommandFeedback>}
Rotate a motor by a given amount of degrees.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
degrees |
number |
How much the motor should be rotated (in degrees). |
||
speed |
number |
<optional> |
100 |
For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. |
interrupt |
boolean |
<optional> |
false |
If true, previous commands are discarded. |
- Inherited From:
- Source:
setAccelerationTime(time, profile, interruptopt) → {Promise.<CommandFeedback>}
Set the global acceleration time
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
time |
number |
How long acceleration should last (in milliseconds). |
||
profile |
number |
0 by default |
||
interrupt |
boolean |
<optional> |
false |
If true, previous commands are discarded. |
- Inherited From:
- Source:
setBrakingStyle(style)
Set the braking style of the motor.
Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.
Parameters:
Name | Type | Description |
---|---|---|
style |
number |
Either BRAKE or HOLD |
- Inherited From:
- Source:
setDecelerationTime(time, profile, interruptopt) → {Promise.<CommandFeedback>}
Set the global deceleration time
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
time |
number |
How long deceleration should last (in milliseconds). |
||
profile |
number |
0 by default |
||
interrupt |
boolean |
<optional> |
false |
If true, previous commands are discarded. |
- Inherited From:
- Source:
setMaxPower(style)
Set the max power of the motor.
Note: This applies to setSpeed, rotateByDegrees, and gotoAngle.
Parameters:
Name | Type | Description |
---|---|---|
style |
number |
Either BRAKE or HOLD |
- Inherited From:
- Source:
setSpeed(speed, time, interruptopt) → {Promise.<CommandFeedback>}
Set the motor speed.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
speed |
number |
For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0. |
||
time |
number |
How long the motor should run for (in milliseconds). |
||
interrupt |
boolean |
<optional> |
false |
If true, previous commands are discarded. |
- Inherited From:
- Source:
Events
absolute :object
Emits when a the motors absolute position is changed.
Parameters:
Name | Type | Description |
---|---|---|
absolute |
number |
- Inherited From:
- Source:
rotate :object
Emits when a rotation sensor is activated.
Parameters:
Name | Type | Description |
---|---|---|
rotation |
number |
- Inherited From:
- Source: