Reference for Wiring version 0024+. 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 October 31, 2009 01:47:11pm PDT

Creative Commons License