View Single Post
  #9   Spotlight this post!  
Unread 26-07-2015, 20:00
Necroterra's Avatar
Necroterra Necroterra is offline
Registered User
FRC #4183 (Bit Buckets)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Tucson
Posts: 26
Necroterra will become famous soon enough
Re: Which sensors should be used throughout the robot?

Quote:
Originally Posted by thatprogrammer View Post
How exactly are the reed switches programmed? Same as limit switches?
I see people already let you know that you can use these magnetic reed switches as a standard DigitalInput, or set it up as the Limit Switch on a TalonSRX, but there's a few others. The class Counter can be used as such:

Code:
Counter reedSwitchWatcher = new Counter(channel)
or
Code:
Counter reedSwitchWatcher = new Counter(digitalInput)
As well as a few others. This tells the FGPA to directly watch the digitalInput and count when it is active / rising edges / falling edges / whatever you set it to. This means you don't have to check the switch as often as you would if you were accessing it directly, and you can use it to act on a switch's activation much more precisely.

There is also an Interrupt system built into the processor, but I never used it. From what I understand, it's essentially an event handler which executes a function handler when a DigitalInput is fired.
__________________

2015 Arizona East - Regional Winners, Creativity Award