View Single Post
  #2   Spotlight this post!  
Unread 01-11-2011, 02:19 AM
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: How do I use interrupt in Java?

Quote:
Originally Posted by danielcezar View Post
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
Reply With Quote