Go to Post Do you mean...? If so, it's illegal under . (insert your favorite reminder to read the manual here) - EricH [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 Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 04-03-2010, 12:24 PM
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
What was the hardest to program this year in Java?

I was going around, and I know that people make classes/interfaces for doing the bizzare things that are used frequently on their robots.

For me is was getting DigitalInputs working, to do that, I made this class:

Code:
package com.shadowh511.mayor.inputs;

import edu.wpi.first.wpilibj.DigitalInput;

public class Switch {
    private DigitalInput source;

    public Switch(int channel) {
        this.source = new DigitalInput(4,channel);
    }

    public Switch(int slot, int channel) {
        this.source = new DigitalInput(slot,channel);
    }

    public boolean oldGet() {
        return this.source.get();
    }

    public boolean get() {
        if(!this.source.get()) {
            return true;
        } else {
            return false;
        }
    }
}
what you use to call this is:

Code:
Switch ballSwitch = new Switch(4);
or

Code:
Switch ballSwitch = new Switch(4,4);
I recommend the bottom one just to be on the safe side.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java this year? Mo_Shen General Forum 6 01-06-2010 10:52 AM
What is the hardest (yet possible) task in this year's game? Wayne C. General Forum 88 01-16-2008 06:30 PM
What year was the hanging bar from? Jeremy General Forum 3 01-11-2004 11:00 PM
What was your best memory from this year/ever? miketwalker General Forum 30 05-01-2003 01:24 PM
What was the most innovative feature this year? archiver 2001 15 06-24-2002 04:17 AM


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

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