Thread: IR Sensor
View Single Post
  #6   Spotlight this post!  
Unread 29-01-2008, 14:52
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Re: IR Sensor - Create 100 ms timer loop

Quote:
Originally Posted by Steve Dobler View Post
How do you deal with the fact that the inputs are being pulsed on and off at around every 100ms? How does the program keep from repeating multiple times?
One method is to create a timer loop that runs every 100 msec that read's all four switches and saves the status. So, after 100 msec, the first thing inside the loop is to reset the timer to 0 and start again. Next, all four inputs are read and saved. 100 msec timer loop ends. Last, this routine can then be called whenever you want to determine the IR.
As long as 100 msec has expired since the last time you ran the loop, it should begin immediately.
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377

Last edited by marccenter : 29-01-2008 at 14:52. Reason: Clean up