Log in

View Full Version : JAVA Printing


Mk.32
11-02-2011, 02:17
Hello,
Is there any way to print something from the code and have it display to the user?
Tired System.out.print(); and didn't see anything come up.
Thanks in advance :)

mwtidd
11-02-2011, 06:55
public void output(String text){
System.out.println(text);
}

Ben_R_R
11-02-2011, 13:19
That prints to the Net Beans console, useful for debugging, not so useful in competition though. Does any one know how to print to the Drive Station console?

mwtidd
11-02-2011, 13:45
printing to the driver station you only have 7 lines or so, and you have to replace previous lines. So utilizing it for debugging is a little difficult.

it doesnt work like a typical printf where you can keep going.

morganfshirley
12-02-2011, 13:25
To output text to the Driver Station, you must create a DriverStationLCD object. Once it has been initialized, lines can be outputted using:

[DriverStationLCD object name].println(DriverStationLCD.Line.[line],
[Priority], [message]);

You will also need to use a .updateLCD() command to get it to write to the Driver's Station.

Ben_R_R
12-02-2011, 13:48
Ah, yes that worked. For some reason I got a null pointer exception when I tried that before. It worked now though. Thanks!