Skip to content

Adding a ready to compile example-code? #6

@StefanL38

Description

@StefanL38

Hi John,

I was looking at the example-code in the comment-section of the encoder.h

/* USAGE FOR ONE ENCODER:
// define the input pins
#define pinA 19
#define pinB 20
#define pinP 21
// create an encoder object initialized with their pins
Encoder encoder( pinA, pinB, pinP );
// setup code
void setup() 
{
  // start the encoder time interrupts
  EncoderInterrupt.begin( &encoder );
}
// loop code
void loop()
{
  // read the debounced value of the encoder button
  bool pb = encoder.button();
  // get the encoder variation since our last check, it can be positive or negative, or zero if the encoder didn't move
  // only call this once per loop cicle, or at any time you want to know any incremental change
  int delta = encoder.delta();
  // add the delta value to the variable we are controlling
  myEncoderControlledVariable += delta;
  // do stuff with the updated value
  // that's it
}
*/  
´´´
it is missing the include-compiler-directive
Would you mind adding this to make the code ready to compile?

best regards Stefan 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions