write()

Description

Set 86Duino encoder counter value. Use with Pulse/DIR, CW/CCW and A/B Pulse operating mode.

Syntax


Enc0.write(number)
Enc1.write(number)
Enc2.write(number)
Enc3.write(number)

Parameters

Enc0、Enc1、Enc2、Enc3:Correspond to ENC0、ENC1、ENC2、ENC3 encoder interface.

number:Encoder counter value to be set(unsigned long)

Returns

None

Example

#include <Encoder.h>

void setup() {
  Serial.begin(9600);
  Enc0.begin(MODE_AB_PHASE);
  Enc0.write(200L);// Set the counter to start counting from 200
}

void loop() {
  Serial.println(Enc0.read());
  delay(100);
}

See also

read()


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.