I try to load Dr, Hessmer's Quadrature encoder sketch after changing #include "WProgram.h" to #include "arduino.h" and I keep getting the error "WProgram.h, No such file or directory"
I don't know why the compiler is looking for WProgram.h when I'm not calling for it.
I've looked through most of the posts on this subject, and there are many, and can't seem to find a solution.
What am I missing?
notepad program.txt (3.6 KB)
Spycatcher2k, Thanks.
Could you please share a sample of the code as changed?
dougrundell:
I keep getting the error "WProgram.h, No such file or directory"
The error message will tell you what line of what file it is complaining about. Go to that file and fix it, too.
If the file was #included it will also tell you what file has the #include.
Success! Sort of. The program runs but no matter which direction the motors turn, the encoder output goes the same direction. Left encoder counts negative and right encoder counts positive.
My code is at the top of the page.
Thanks for any help.
dougrundell:
The program runs but no matter which direction the motors turn, the encoder output goes the same direction. Left encoder counts negative and right encoder counts positive.
Perhaps the "B" inputs are stuck?
Note: The comment on this code does not match what the code does:
digitalWrite(c_LeftEncoderPinA, LOW); // turn on pullup resistors
digitalWrite(c_LeftEncoderPinB, LOW); // turn on pullup resistors
digitalWrite(c_RightEncoderPinA, LOW); // turn on pullup resistors
digitalWrite(c_RightEncoderPinB, LOW); // turn on pullup resistors
Writing LOW will turn OFF the pull-up resistor.
This line also has a contradictory comment:
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
Thanks, John, I'll try some modifications.