Go to Post Do you have to think about FIRST when you get up in the morning? - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 13-02-2010, 13:50
EthanMiller EthanMiller is offline
Lead Programmer
AKA: Socks
FTC #4356 (The Zip Ties)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Clayton, NY
Posts: 121
EthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura about
Re: Toggle through button?

Depending on what language you're using, and assuming that we're using Java and joystick button 2, the code would look something like:

Code:
if joystick.getButton(2) == true && number < 2 {
     number++
} else if joystick.getButton(2) == true && number == 2 {
     number = 0
}
Note - this code is untested. Be sure to declare "number" and set it to 0 earlier in the program.

Also, this code will use values 0, 1, and 2, rotating each time the button is pressed.
__________________
When all else fails, read the manual.

FRC 1713 K Island Gears 2009, 2010 (Not 2011 due to budget, hopefully 2012!) - Fingerlakes Regional

FTC 4356 The Zip Ties 2010-2011 Season - NNYRC (2010 9th seed).
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Labview toggle switch GunfighterJ NI LabVIEW 8 13-02-2011 18:03
can you use a single button as a toggle? woogit General Forum 1 15-02-2008 14:21
toggle switch Windward Programming 31 27-01-2006 22:38
Code: Toggle on Tap Dave Scheck Programming 0 11-02-2005 18:07
Toggle? f22flyboy Programming 5 03-11-2002 08:03


All times are GMT -5. The time now is 21:29.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi