L1TH1UM
21-03-2015, 14:49
Hello,
We are having some issues using the preferences table utility on SmartDashboard. We are supposed to be getting a table from which we can edit robot preferences such as potentiometer setpoints and encoder setpoints.
However, when we run the code it throws a Null Pointer Exception because we declared the preferences varable (Preferences prefs;) but we didn't create and object and we are trying to use an operator (prefs.getDouble). Using "prefs = new Preferences();" does not work, and there's nothing on the wpilibj documentation that tells us how to fix this (create an object for preferences).
Here's the page we're referencing: https://wpilib.screenstepslive.com/s/4485/m/26401/l/255423-setting-robot-preferences-from-smartdashboard
Our code is almost exactly the same as that just minor differences such as names and values. We are programming in Java.
Any help would be appreciated, thanks.
We are having some issues using the preferences table utility on SmartDashboard. We are supposed to be getting a table from which we can edit robot preferences such as potentiometer setpoints and encoder setpoints.
However, when we run the code it throws a Null Pointer Exception because we declared the preferences varable (Preferences prefs;) but we didn't create and object and we are trying to use an operator (prefs.getDouble). Using "prefs = new Preferences();" does not work, and there's nothing on the wpilibj documentation that tells us how to fix this (create an object for preferences).
Here's the page we're referencing: https://wpilib.screenstepslive.com/s/4485/m/26401/l/255423-setting-robot-preferences-from-smartdashboard
Our code is almost exactly the same as that just minor differences such as names and values. We are programming in Java.
Any help would be appreciated, thanks.