Our team is programming in Java, and we can’t find out how to create a proper instance of an encoder. We looked at the constructor method for Encoder, and it needs a boolean. However, when we put ‘true’ or ‘false’ in, we kept producing an error. The code looks sort of like this:
rfEncoder = new Encoder(true, 5);
since this isn’t working, what should we do instead?
I’ve looked through the javadocs, and the only boolean you would ever need to pass the constructor would be for the reverseDirection. Eg. Below.
Encoder(int aChannel, int bChannel, boolean reverseDirection)
Are you sure your looking at the Encoders in the Java 2011 Javadocs? I can’t think of another reason why the javadocs you’re looking at simply calls for two arguments, one of which is a boolean.
Are you trying to program the magnetic encoders or the quad us Digital ones? I only have experience with the USDigital ones, with them you need two digital inputs for them to function correctly.
Edit:
Noticed you mentioned that the code look sort of like that. Could you post the exact line your writing?