RobotCore
Robot Core Documentation
Classes | Public Member Functions | List of all members
robotCore.Encoder Class Reference

The Encoder interface is implemented by classes which track an relative position. More...

Classes

enum  EncoderType
 

Public Member Functions

 Encoder (EncoderType type, int pin1, int pin2, int i2cAddr)
 
 Encoder (EncoderType type, int pin1, int pin2)
 
int get ()
 
int getPosition ()
 
int getSpeed ()
 
Encoder Clone ()
 
void reset ()
 
void setInverted (boolean invert)
 

Detailed Description

The Encoder interface is implemented by classes which track an relative position.

Author
John Gaby

Constructor & Destructor Documentation

◆ 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)

Member Function Documentation

◆ 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: