Go to Post And, if you don't know what something means, say so, we'll be happy to explain. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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
  #20   Spotlight this post!  
Unread 24-11-2015, 15:25
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: Using encoder with talon SRX

If you are using RobotBuilder then you can to a "whenPressed" action...
https://wpilib.screenstepslive.com/s...e-to-a-command

If you are using command classes yourself there is a Button class you could wire into the scheduler.

If you are just writing straight java, I usually just copy/paste the following...

Code:
//instance variables
    boolean [] btns  = new boolean [] {false,false,false,false,false};
    boolean [] last  = new boolean [] {false,false,false,false,false};
Code:
//get latest
    public void teleopPeriodic() {

        btns[1] = _joy.getRawButton(1);
    	btns[2] = _joy.getRawButton(2);
    	btns[3] = _joy.getRawButton(3);
    	btns[4] = _joy.getRawButton(4);
Code:
    	if(!last[3] && btns[3]){
    		//btn3 just pressed, do something
    	}

Code:
// bottom of teleop save all btns into last
		for(i=0;i<last.length;++i)
			last[i] = btns[i];
Reply With Quote
 


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 10:16.

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