Go Down

Topic: Is there anybody know about this type of encoder using (Read 406 times) previous topic - next topic

gclu

Mar 09, 2013, 05:08 pm Last Edit: Mar 09, 2013, 05:26 pm by gclu Reason: 1
Hi all,

I have these encoder below ( Please see encoder );

http://robotus.net/wp-content/uploads/2012/07/manyetik-encoder-forceup.jpg

and I want to do these;

http://www.youtube.com/watch?v=4YLTHjbZVP0

I have already done the 200 RPM DC Motor PWM control and now only I am trying to see position on serial monitor.
(using arduino uno)

I search a lot of code and try in the rotary encoder libraries etc. but
For example when I  use this code;

Code: [Select]


#include <Encoder.h>

Encoder myEnc(2, 3);


void setup() {
  Serial.begin(9600);
  Serial.println("Basic Encoder Test:");
}

long oldPosition  = -999;

void loop() {
  long newPosition = myEnc.read();
  if (newPosition != oldPosition) {
    oldPosition = newPosition;
    Serial.println(newPosition);
  }
}



I have this result in Serial Monitor;

Basic Encoder Test:
-1
0
1
0
-1
0
1
0
-1
...

I tried a lot of working code and most of them give me same result

But I want to have
Basic Encoder Test:
1
2
3
4
...

something like that. I am wondering is the problem could be my encoder type ? Because, I have never seen any project example in net.

So, anybody have an idea about to use these kind of encoder with interrupt.

Thanks.

johnwasser

Looks like one of the two quadrature channels is not working.  Check the wiring between S1/S2 and Pin2/Pin3.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up