Quote:
Originally Posted by RufflesRidge
The sample on that page seems to be missing a line:
prefs = Preferences.getInstance();
|
You're right! Thats quite funny. Here's the actual code for reference
Code:
package org.usfirst.frc.team40.robot;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.Preferences;
public class Robot extends SampleRobot{
Preferences prefs;
double armUpPosition;
double armDownPosition;
public void robotInit(){
prefs = Preferences.getInstance();
armUpPosition = prefs.getDouble("ArmUpPosition", 1.0);
armDownPosition = prefs.getDouble("ArmDownPosition", 4.0);
}
}
On a side note, to follow NetworkTable conventions the method name should be "getNumber" but that is trivial.