View Single Post
  #2   Spotlight this post!  
Unread 26-01-2013, 23:55
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Buttons without Scheduler

Quote:
Originally Posted by joelg236 View Post
I need to implement functionality with buttons on the SmartDashboard which do things to the robot. I do not want to use Scheduler, since we are not using command-based. Is there a way to do this without making a smartdashboard widget and hack network tables backwards?
make a class that implements Sendable

and put in this data somewhere

Code:
    public String getSmartDashboardType(){
        return "Button";
    }
    private ITable table;
    public void initTable(ITable table){
        this.table = table;
        if(table!=null){
            table.putBoolean("pressed" false);
        }
    }
    
    /**
     * {@inheritDoc}
     */
    public ITable getTable(){
        return table;
    }
to check if the button is currently pressed on the dashboard, just use

Code:
table.getBoolean("pressed");
(not 100% sure about this but thats how Trigger does it)

e/ No. send it to the dashboard via

Code:
SmartDashboard.putData(yourButton)
than get it via

Code:
SmartDashboard.getData(yourButton
Reply With Quote