Encoder \ Libraries \ Wiring 1.0 (ALPHA)

| Index

| Reference for Wiring 1.0 (ALPHA) 0021+. 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.

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