To answer OP's question, you could call NetworkTable.putDouble() in a widget to send a number and then call NetworkTable.getDouble() in the robot's code to retrieve it.
Driver's side:
Code:
NetworkTable.getTable("SmartDashboard").putDouble("Pi", 3.14159);
Robot side:
Code:
double pi = NetworkTable.getTable("SmartDashboard").getDouble("Pi");
Slightly offtopic here; this is aimed towards Ginto8.
Quote:
Originally Posted by Ginto8
You would put the code wherever you want to send or receive a new value - for example, if you have an extension that retrieves the state of the robot's drive train, you could have a TimerTask which periodically refreshes it, and the data retrieval would go in there.
I'm pretty sure that there's also some way to have the data automatically refreshed when it changes, but I haven't figured out how to use it yet - though I'm guessing it's possible by implementing NetworkListener or NetworkAdditionListener.
|
Don't bother with using a TimerTask; the new NetworkTables will use listeners to update values when they change in the table.