View Single Post
  #2   Spotlight this post!  
Unread 31-01-2008, 22:12
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,998
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Interrupts, limit switches, and IR board

An interrupt is just what it says: The processor interrupts what it was doing and does whatever the interrupt routine says until the interrupt is cleared. So, interrupts are usually saved for stuff that happens so quick a normal loop might miss it.

For a limit switch, you don't usually need an interrupt.

Same for the IR board. Your loop is something like 26 milliseconds, the IR board puts out a 100 millisecond pulse, that means you can see the IR board signal at least three times before it goes away.

If the limit switch is being pressed for less than 26 mSec, maybe use an interrupt, but if not...


Just use a digital input, but remember that the input pin is pulled high (+5v weakly inside the RC, so what you need to do is connect the switch to ground on one side and the digital input pin on the other side. Also make sure the digital pin you use is really set up as an INPUT, not an output. (I also read that you need to enable the pull-up resistor, but I don't know enough to explain how, or if).

Don
__________________

I am N2IRZ - What's your callsign?