The Encoder interface is implemented by classes which track an relative position.
More...
The Encoder interface is implemented by classes which track an relative position.
- Author
- John Gaby
◆ Encoder() [1/2]
robotCore.Encoder.Encoder |
( |
EncoderType |
type, |
|
|
int |
pin1, |
|
|
int |
pin2, |
|
|
int |
i2cAddr |
|
) |
| |
- Parameters
-
type | - Specifies the type of encoder |
pin1 | - Specifies the first pin that the encoder uses. If it is a quadrature encoder, this must be the interrupt pin |
pin2 | - Specifies the second pin that the encoder uses (Not use if type is simple) |
i2cAddr | - Address of i2c arduino which reads encoder |
◆ Encoder() [2/2]
robotCore.Encoder.Encoder |
( |
EncoderType |
type, |
|
|
int |
pin1, |
|
|
int |
pin2 |
|
) |
| |
- Parameters
-
type | - Specifies the type of encoder |
pin1 | - Specifies the first pin that the encoder uses. If it is a quadrature encoder, this must be the interrupt pin |
pin2 | - Specifies the second pin that the encoder uses (Not use if type is simple) |
◆ clone()
Encoder robotCore.Encoder.clone |
( |
| ) |
|
Creates a copy of the encoder. The copy accesses the same physical device but can be reset independently.
◆ get()
int robotCore.Encoder.get |
( |
| ) |
|
Gets the current encoder value
- Returns
- Returns the current position or speed
◆ getPosition()
int robotCore.Encoder.getPosition |
( |
| ) |
|
Gets the current encoder value
- Returns
- Returns the current position
◆ getSpeed()
int robotCore.Encoder.getSpeed |
( |
| ) |
|
Gets the current encoder value
- Returns
- Returns the current speed
◆ reset()
void robotCore.Encoder.reset |
( |
| ) |
|
Resets the encoder to zero
◆ setInverted()
void robotCore.Encoder.setInverted |
( |
boolean |
invert | ) |
|
- Parameters
-
invert | = If True, the count and speed directions are reversed |
The documentation for this class was generated from the following file:
- D:/SDASVN/2022/RaspberryPi/Source/robotCore/Encoder.java