View Single Post
  #2   Spotlight this post!  
Unread 20-02-2010, 00:49
PriyankP's Avatar
PriyankP PriyankP is offline
Registered User
FRC #0188 (Woburn Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Toronto, Canada
Posts: 87
PriyankP has much to be proud ofPriyankP has much to be proud ofPriyankP has much to be proud ofPriyankP has much to be proud ofPriyankP has much to be proud ofPriyankP has much to be proud ofPriyankP has much to be proud ofPriyankP has much to be proud ofPriyankP has much to be proud of
Re: Limit Switch Programming Help (Have almost all of it figured out)

The last time I played around with one of the limit switches in our room, I found out that the switch will continuously output 1 if its NOT pressed. As soon as it is pressed, it will output 0. (I use C/C++)

So what I did was,

DigitalInput switch; // A variable that will get a value of 1 or 0 depending on the limit switch...

then

swich(13), // The port id it uses

then in the Tele op continuous,



if button 2 is pressed then
turn the motor in the + direction

and

check if switch is equal to 0
if switch is 0 then
stop the motor


or else,
just stop the motor


I am pretty sure that if you use a code like that, you wont need the second limit switch. (if I am correct as to why you have it)

Now, you can convert this pseudo code into any programming language!!

Good Luck, I hope this helped!
__________________
Champs Schedule Highlighter App [CD Thread]

#### XYZ Regional Finalists

Last edited by PriyankP : 20-02-2010 at 00:51.