Pages: [1]   Go Down
Author Topic: Is there anybody know about this type of encoder using  (Read 299 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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;



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:

#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.
« Last Edit: March 09, 2013, 11:26:10 am by gclu » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 180
Posts: 8096
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like one of the two quadrature channels is not working.  Check the wiring between S1/S2 and Pin2/Pin3.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: