This article is automatically translated from Russian by Google Translator.
Represents power motor encoders connected to ports E1, E2, E3, E4.
| |
| Returns the current encoder reading in degrees on the specified port. |
| Resets the current encoder reading to 0. |
| Returns the current encoder reading in "ticks" on the specified port. |
read
Returns the current encoder reading in degrees on the specified port.
Syntax
brick.encoder(portName).read();
brick.encoder("portName").read();
brick.encoder(portName).read();
brick.encoder("portName").read();
As a parameter, you must specify the port.
Example
brick.encoder(E1).read();
brick.encoder("E2").read();
brick.encoder(E1).read();
brick.encoder("E2").read();
reset
Resets the current encoder reading to 0.
Syntax
brick.encoder(portName).reset();
brick.encoder("portName").reset();
brick.encoder(portName).reset();
brick.encoder("portName").reset();
As a parameter, you must specify the port.
Example
brick.encoder(E1).reset();
brick.encoder("E2").reset();
brick.encoder(E1).reset();
brick.encoder("E2").reset();
readRawData
Returns the current encoder reading in "ticks" on the specified port.
Syntax
brick.encoder(portName).readRawData();
brick.encoder("portName").readRawData();
brick.encoder(portName).readRawData();
brick.encoder("portName").readRawData();
Example
brick.encoder(E1).readRawData();
brick.encoder("E2").readRawData();
brick.encoder(E1).readRawData();
brick.encoder("E2").readRawData();