View Single Post
  #3   Spotlight this post!  
Unread 12-02-2011, 01:18
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Event listening for a counter.

Quote:
Originally Posted by Itamar View Post
more efficient?
I don't believe explaining the algorithm is neccessery right now. Basically, I would like to stop a motor from running the moment a microswitch is clicked.
This is normally a very easy task to accomplish, but my code has many other VIs to run and take care of, so I wanted to try using events of interrupts.
So this is not really about efficiency, it's more about how much time it takes for the motor to stop, and I believe that by using an event the response would be immediate.
With parallel loops, it doesn't have to run all the code before going onto the next loop, which would provide fast stopping for the motor. Just put the speeds of the motors in a global variable and ship it over to periodic tasks. You can also read the sensor in periodic tasks.

And yes, if your switch is normally closed, wiring it straight up to the jaguars is much easier (and safer!) assuming you don't ever want to go past the limit switch (it is limiting...)
Reply With Quote