Search wiring.org.co:

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 | ### 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();           // detach the encoder
      }
    }
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

Updated on October 31, 2009 01:47:25pm PDT