Go to Post You have to start at the bottom to get to the top, usually. - Kyle [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
  #1   Spotlight this post!  
Unread 24-11-2012, 17:09
Skyehawk's Avatar
Skyehawk Skyehawk is online now
Nuts N' Bolts
AKA: Skye Leake
FRC #0876 (Thunder Robotics)
Team Role: Mentor
 
Join Date: Nov 2012
Rookie Year: 2011
Location: Northwood, ND
Posts: 240
Skyehawk is a name known to allSkyehawk is a name known to allSkyehawk is a name known to allSkyehawk is a name known to allSkyehawk is a name known to allSkyehawk is a name known to all
Enhanced I/O through Cypress

Our team is new to the Enhanced I/O through Cypress. I have done everything to spec in setting it up except one thing; when I tried to load the 2012.hex onto the module it said fail in the lower right hand corner (where it says connected) so I used the 2009.hex and it loaded fine. The DS reconized it and I have full suport on the DS of all the functions that are native.

When I loaded my code onto the robot I am using Cypress to get a button value. Here's where I need help:
Initilized:
Code:
    public class RobotClass extends IterativeRobot {
        Relay Feed = new Relay(2);
        DriverStationEnhancedIO Cypress = DriverStation.getInstance().getEnhancedIO();
Teleop:
Code:
if (Cypress.getButton(2) ) {
                Feed.setDirection(Relay.Direction.kForward);
            } else if (Cypress.getButton(3)) {
                Feed.setDirection(Relay.Direction.kReverse);
            } else {
                Feed.set(Relay.Value.kOff);
Netbeans wants me to sorround the teleop portion of code with a try - catch statement:
Code:
        try {
            if(Cypress.getButton(2) ) {
                    Feed.setDirection(Relay.Direction.kForward);
                } else if (Cypress.getButton(3)) {
                    Feed.setDirection(Relay.Direction.kReverse);
                } else {
                    Feed.set(Relay.Value.kOff);
            }
        } catch (EnhancedIOException ex) {
            ex.printStackTrace();
        }
Is the try - catch the correct way to do this? It doesnt seem right. If it isn't, what is the correct way to do this?
Thanks,
Skyehawk
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 11:34.

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