Go to Post Wait, robot? We've been working on building a team. - rtfgnow [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-02-2012, 11:45
dwmcc dwmcc is offline
Registered User
FRC #2192 (YAK Attack)
Team Role: Leadership
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Newport, Oregon
Posts: 14
dwmcc is an unknown quantity at this point
How to make "sticky" joystick buttons?

Hello All,
I'm wondering how to create "sticky" joystick buttons, AKA an action (let's say set Relay to ON) is defaulted on at the beginning of a match, and pressing a specific button will toggle the relay ON or OFF, not momentarily changing it's status.

Thanks!
dwmcc
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2012, 11:52
lemiant's Avatar
lemiant lemiant is offline
the Dreamer
AKA: Alex
FRC #4334 (Alberta Tech Alliance)
Team Role: Leadership
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Calgary, AB, Canada
Posts: 562
lemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond repute
It's a little complicated. You need to start by detecting each button press as a unique event (instead of toggling for every loop during which the button is held down). At the end of every loop save the old button value. Only when the current value is pressed and the one from the previous loop is not pressed should you toggle the setting. Then you create a variable to store the state of your toggle and then you just change it every time we see a button press with the above logic.
__________________
FRC Team 4334
2012 - Archimedes Champions, IRI Champions
2013 - Western Canadian Regional Winner, Galileo Quarter-Finalilst

Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2012, 12:07
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How to make "sticky" joystick buttons?

Quote:
Originally Posted by dwmcc View Post
Hello All,
I'm wondering how to create "sticky" joystick buttons, AKA an action (let's say set Relay to ON) is defaulted on at the beginning of a match, and pressing a specific button will toggle the relay ON or OFF, not momentarily changing it's status.

Thanks!
dwmcc
http://www.chiefdelphi.com/forums/sh...30&postcount=3

Reply With Quote
Reply


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


All times are GMT -5. The time now is 08:48.

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