mirror of
https://github.com/Team4388/2024AcrossTheRidgebotiverse.git
synced 2026-06-09 00:38:02 -06:00
Configurables
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
package frc4388.utility.configurable;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||||
|
|
||||||
|
public class ConfigurableDouble {
|
||||||
|
private double defualtValue;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an new ConfigurableDouble through Smart Dashboard.
|
||||||
|
* @param name the name of the Smart Dashboard key.
|
||||||
|
* @param defualtValue the initilization value
|
||||||
|
*/
|
||||||
|
public ConfigurableDouble(String name, double defualtValue) {
|
||||||
|
this.name = name;
|
||||||
|
this.defualtValue = defualtValue;
|
||||||
|
SmartDashboard.putNumber(name, defualtValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double get() {
|
||||||
|
return SmartDashboard.getNumber(name, defualtValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package frc4388.utility.configurable;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||||
|
|
||||||
|
public class ConfigurableString {
|
||||||
|
private String defualtValue;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an new ConfigurableString through Smart Dashboard.
|
||||||
|
* @param name the name of the Smart Dashboard key.
|
||||||
|
* @param defualtValue the initilization value
|
||||||
|
*/
|
||||||
|
public ConfigurableString(String name, String defualtValue) {
|
||||||
|
this.name = name;
|
||||||
|
this.defualtValue = defualtValue;
|
||||||
|
SmartDashboard.putString(name, defualtValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String get() {
|
||||||
|
return SmartDashboard.getString(name, defualtValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user