N00bfirst
22-01-2015, 21:38
Our dashboard does not seem to display any message whatsoever when we try to run the robot code.
Can anybody please explain why such a thing is happening and how we can write to the dashboard?
This is just sample code to get the hang of the encoder average encoder value. Apologies for the terrible variable names.
However, it does not display a message even if I do something simple like trying to print a value onto the dashboard.
public void autonomousInit() {
autoLoopCounter = 0;
Encoder sampleEncoder = new Encoder(8, 9, false, Encoder.EncodingType.k2X);
sampleEncoder.setMaxPeriod(0.1);
sampleEncoder.setMinRate(10);
sampleEncoder.setDistancePerPulse(5);
sampleEncoder.setSamplesToAverage(7);
sampleEncoder.reset();
SmartDashboard.putNumber("hmm", 2);
double k = sampleEncoder.getRate();
boolean what = sampleEncoder.getStopped();
String huh = sampleEncoder.getSmartDashboardType();
while (k>10){
String k2 = Double.toString(k);
double distance = sampleEncoder.getDistance();
String distance1 = Double.toString(distance);
SmartDashboard.putNumber(k2, k);
SmartDashboard.putNumber(distance1, distance);
SmartDashboard.putBoolean(huh, what);
}
Can anybody please explain why such a thing is happening and how we can write to the dashboard?
This is just sample code to get the hang of the encoder average encoder value. Apologies for the terrible variable names.
However, it does not display a message even if I do something simple like trying to print a value onto the dashboard.
public void autonomousInit() {
autoLoopCounter = 0;
Encoder sampleEncoder = new Encoder(8, 9, false, Encoder.EncodingType.k2X);
sampleEncoder.setMaxPeriod(0.1);
sampleEncoder.setMinRate(10);
sampleEncoder.setDistancePerPulse(5);
sampleEncoder.setSamplesToAverage(7);
sampleEncoder.reset();
SmartDashboard.putNumber("hmm", 2);
double k = sampleEncoder.getRate();
boolean what = sampleEncoder.getStopped();
String huh = sampleEncoder.getSmartDashboardType();
while (k>10){
String k2 = Double.toString(k);
double distance = sampleEncoder.getDistance();
String distance1 = Double.toString(distance);
SmartDashboard.putNumber(k2, k);
SmartDashboard.putNumber(distance1, distance);
SmartDashboard.putBoolean(huh, what);
}