Help with logic for optical encoder?
code: [select]
int encoder(){
int read = digitalread(4);
if(read != lastread){
var = 1;
}
if((var == 1) && (read != lastread)) {
encoderpos++;
var = 0;
lastread = read;
}
}
is wrong? can tell me right algorithm?
the sensor working well, looks encoderpos isn't getting bigger.
there more 1 kind of encoder. please post vendor link encoder.
as example here link quadrature encoder , know if using ?
http://playground.arduino.cc/main/rotaryencoders
as example here link quadrature encoder , know if using ?
http://playground.arduino.cc/main/rotaryencoders
Arduino Forum > Using Arduino > Programming Questions > Help with logic for optical encoder?
arduino
Comments
Post a Comment