Go to Post You can admire machines, but you don't really love them... This program has enabled me to make a difference that I believe is good for the future of humans on this planet. - MooreteP [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 01-02-2012, 21:15
Thundrio Thundrio is offline
Dedicated Racer
FRC #3673
 
Join Date: Feb 2011
Rookie Year: 2010
Location: The Internet
Posts: 67
Thundrio is on a distinguished road
A few syntax type questions

As I am going through the state of my teams code, I have a few questions I wanted to ask.

Also I am using iterativeRobot()

1) When I send a line to the driverstation using driverStationLCD(probably not the right syntax, but you know what I want), It displays the text, but does not update the values ever if they are changed in teleop(). I tried putting myLCD.updateLCD() at the bottom of my teleopPeriodic() function, but when I do netbeans says the myLCD variable is not created, even though I create it earlier where the output lines to the ds are. also to be clear, I have verified that the values are actually changing by using the Netconsole+System.out.println().

2) We are able to use the Microsoft Kinect to control the robot, and while we don't know if it will be used during competition, it will be a great way to demonstrate the robot. What I have done is split the teleoperated section of the code into two sections using an if statement like this:
if (isKinect == 1) {
// kinect enabled version of the code goes here
}
else
{
//normal code goes here
}
Right now all of my code is in 1 class file, although I would like to split it up into multiple files, to make it easier to read. it would then theoretically look like this:
if (isKinect == 1) {
run kinectcode.java;
}
else{
run normalcode.java;
}
However I have never worked with multiple files together, and so I am not sure how to do this.

3)right now I have shAUTOFIRE (one of my buttons) written using the .get() function (I believe it's a function), but I only want it run once, not for as long as it's held down.

I know that I could do this using a keyboard:
public void keyPressed(KeyEvent e) {
keyCode = e.getKeyCode();
swith (keyCode) {
case KeyEvent.VK_SPACEBAR:
//do autofire stuff
break;
}

however, I am at a loss as to what to do with the buttons. I looked at the API documentation and found the whenPressed() method, which seems like It should be similar as to what I do with the keyboard, but I don't know what to do.


Thank you for any and all help.
__________________
Interested in a new way of playing old games?
visit http://www.speedrunslive.com for a way to make single player games multiplayer!
visit http://www.zeldaspeedruns.com to open up a new world for zelda lovers!
pm me here or at zsr for more information!
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 08:33.

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