Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.
| Class | Encoder |
||||
|---|---|---|---|---|---|
| Name | attached() |
||||
| Examples | #include <Encoder.h> int position; Encoder myEncoder; void setup() { // ataches the encoder to pins EI2 and pin 8 // EI2 is pin 18 on Wiring S // EI2 is pin 2 on Wiring v1 myEncoder.attach(EI2, 8); myEncoder.write(0); // set the encoder position to 0 } void loop() { if (myEncoder.attached()) { // read the encoder position position = myEncoder.read(); // detach the encoder myEncoder.detach(); } } |
||||
| Description | Returns true if an encoder is attached. | ||||
| Syntax | encoder.attached() |
||||
| Parameters |
|
||||
| Returns | boolean: true if the encoder is attached. | ||||
| Usage | Application |

