Problem sending messages to Driver Station LCD

Every time I try to send a message to the LCD I get a NullPointerException, no matter what I try or who’s code I copy. If it hits the line


DriverStationLCD.getInstance().println(DriverStationLCD.Line.kMain6, 1, msg);

it throws an exception. What am I doing wrong?

Thanks!

Ah, the LCD. I’m pretty sure that you just forgot an import.
Did you import BOTH of these?


import edu.wpi.first.wpilibj.DriverStationLCD;
import edu.wpi.first.wpilibj.DriverStationLCD.Line;

If so…In my code I always use


Line.kUser6

instead of


DriverStationLCD.Line.kUser6

but that probably wouldn’t make a difference.
Also, make sure you update the LCD. You won’t see any output otherwise.

Please post the exception you’re getting (including the stack trace) and we can try to help

  • Ron
    Team #2607 controls mentor

ArchVince’s suggestion seems to have worked. Weird, since I’m pretty sure I tried that once. Must have had the syntax wrong.

Thanks for all the help!