Quote:
Originally Posted by danielcezar
I've been spent i lot of time trying to figure out how to use interrupt in java for FRC, but i didnt find anywhere on the web.
I need to use a interrupt with encoder and another one by time, each 25ms, a interruption be called.
thanks
|
If you look that the DigitalInput class in WPILibJ, you will notice that it inherits the InterruptableSensorBase methods. You can use that to interrupt on inputs hooked to an encoder.
The real question is why you think you need interrupts at all. The Encoder class in WPILibJ accesses hardware quadrature decoders in the FPGA that remove the need for interrupts or timers. If you are using simple encoders, then you can use the Counter class in WPILibJ. Both of these classes will keep track of how far the encoder has gone and will tell you how fast it's moving.
-Joe