View Single Post
  #2   Spotlight this post!  
Unread 10-03-2016, 20:19
RufflesRidge RufflesRidge is online now
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 985
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Access the Auto List on Driver Station in Java

Here's some sample code that should get you started.

Class members:
final String defaultAuto = "Default";
final String customAuto = "My Auto";
String[] autoList = {defaultAuto, customAuto};
String autoSelected;

in robotInit():
NetworkTable table = NetworkTable.getTable("SmartDashboard");
table.putStringArray("Auto List", autoList);

in autonomousInit():
autoSelected = (String) chooser.getSelected();
System.out.println("Auto selected: " + autoSelected);

in autonomousPeriodic():
switch(autoSelected) {
case customAuto:
//Put custom auto code here
break;
case defaultAuto:
default:
//Put default auto code here
break;
}
Reply With Quote