Reference for Wiring version 0027+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Class

Encoder

Name

write()

Examples
#include "Encoder.h"

boolean firstTime = true;
Encoder myEncoder;

void setup() {
  myEncoder.attach(2, 8);
}

void loop() {
  // Set the encoder's postion to 0
  if(firstTime == true) {
    myEncoder.write(0); 
    firstTime = false;
  } 
}
Description The write() method sets the the encoder position, it can be used to initialize it, or reset it.
Syntax
encoder.write(value)
Parameters
value int
encoder The Encoder variable
Returns None
Usage Application
Updated on September 16, 2010 09:19:21pm PDT

Creative Commons License