rotary encoder lpd3806 400bm g5 24c connections and arduino program

Submitted by timed on Sat, 12/01/2018 - 09:12
lpd3806 400bm g5 24c arduino

rotary encoder lpd3806 400bm g5 24c connection

Yellow/White = A phase

Blue = B phase

Red =Vcc power +

Black = power -

 rotary encoder lpd3806 400bm g5 24c arduino code

 

ARDUINO CODE FOR lpd3806 400bm g5 24c

 

#include <Encoder.h>

Encoder myEnc(2, 3);

long relaypoint=0;
void setup() {
  Serial.begin(9600);
  Serial.println("Encoder Test:");
}

long oldPosition  = 0;

void loop()
{
  long newPosition = myEnc.read();
  while (newPosition != oldPosition)  

  {
    oldPosition = newPosition;
    relaypoint++;
    Serial.println(relaypoint);
  }
}

 

download arduino library from https://drive.google.com/file/d/0B-H_CXR7-MD9WG5GS3dHWExVRDQ/view?usp=sharing