| Index

| Reference for Wiring 1.0 (ALPHA) 0017+. 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 |  | ### detach()
Examples |  |
    #include <Encoder.h>

    Encoder myEncoder;
    int position;

    void setup() {
      myEncoder.attach(2, 8)  // attaches a encoder with phaseA connected to pin 2 and phaseB connected to pin 8
    }

    void loop() {
      if(myEncoder.attached()) {
        position = myEncoder.read();  // read the encoder position
        myEncoder.detach();
      }
    }
Description |  | The detach() method detaches an Encoder variable from the pins used to attach the encoder.
Syntax |  |
    encoder.detach()
Parameters |  |
encoder |  | The Encoder variable
Returns |  | None
Usage |  | Application