View Single Post
  #5   Spotlight this post!  
Unread 17-02-2004, 17:10
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: sample limit switch code???

it would be much simpler to have the line of code that is controlling the motor also look at the limit switch on a digital input pin, instead of using interrupts

this is not really an interrupt application, because you are controlling the motor output on every loop of your code anyway, there is no reason to interrupt the loop when the switch closes - the victors and spikes dont respond that fast.

besides, contact switches bounce when they open and close - which means, instead of simply going from 0 to 1, they go 0000111110011011010101111111111 - so for every switch closure you will see maybe 20 to 100 interrupts within several milliseconds.