View Single Post
  #14   Spotlight this post!  
Unread 19-01-2013, 20:24
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Utilizing the Smart Dashboard

Quote:
Originally Posted by Arhowk View Post
Code:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.buttons;
import edu.wpi.first.wpilibj.buttons.Trigger;
import edu.wpi.first.wpilibj.command.Command;

/**
 *
 * @author Arhowk
 */
public class t1684_SD_TakeImage extends Trigger{
    public boolean get(){return true;}
    public void whenActive(Command command){
        System.out.println("meh");
    }
    public void whileActive(Command command){
        System.out.println("meh2");
    }
    public void whenInactive(Command command){
        System.out.println("meh3");
    }
}
this displays the button on the dash but wont do anything when clicked...

still getting above error
That's not how you use it.
Code:
Trigger doThingyTrigger;
doThingyTrigger.whenActive(new DoThingy()); // DoThingy is some class extending Command
SmartDashboard.putData("Do Thingy",trigger);
I'd put this in robotInit, but it can be almost anywhere.
__________________
I code stuff.
Reply With Quote