I am trying to read the output from a MA3 encoder (link below) it is a 10-bit version.
I have the basic idea of how this should be done through arduino code, but maybe I am missing something. All I want to do is read the values coming off of the encoder through the serial monitor. Seems straight forward, but when I run the code I the number changes from 300-360 randomly without any motion of the shaft. My code is pasted below.
void loop()
{
x = analogRead(enc);
Serial.println(x);
delay(1000);
}
Any help would be much appreciated. I am doing this basic code so I can know how to construct the LabView code which will be used in a larger project I am working on. Thanks.
Ok great! That worked, thanks. It is now outputting a value between 0 and 1023 which is what the datasheet on the encoder prescribes. This was done using the pulseIn() function. LabView doesn't have an arduino vi for pulseIn(), but thats a problem for another forum I suppose.