indexRead()

Description

Returns voltage potential for pin Z, this function is designed to work in the Pulse/DIR, CW/CCW and A/B Pulse modes.

Syntax


Enc0.indexRead()
Enc1.indexRead()
Enc2.indexRead()
Enc3.indexRead()

Parameters

Enc0、Enc1、Enc2、Enc3:Corresponding to ENC0, ENC1, ENC2 and ENC3 encoder interfaces.

Returns

LOW or HIGH

Example

#include <Encoder.h>

void setup() {
  Serial.begin(9600);
  Enc0.begin(MODE_AB_PHASE);
}

void loop() {
  Serial.println(Enc0.indexRead()); // Output voltage from pin z
  delay(100);
}

See also

begin()
setIndexReset()


Libraries Reference Home

The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.