001/*----------------------------------------------------------------------------*/ 002/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */ 003/* Open Source Software - may be modified and shared by FRC teams. The code */ 004/* must be accompanied by the FIRST BSD license file in the root directory of */ 005/* the project. */ 006/*----------------------------------------------------------------------------*/ 007 008package edu.wpi.first.wpilibj.command; 009 010/** 011 * A {@link PrintCommand} is a command which prints out a string when it is initialized, and then 012 * immediately finishes. It is useful if you want a {@link CommandGroup} to print out a string when 013 * it reaches a certain point. 014 */ 015public class PrintCommand extends InstantCommand { 016 /** 017 * The message to print out. 018 */ 019 private String m_message; 020 021 /** 022 * Instantiates a {@link PrintCommand} which will print the given message when it is run. 023 * 024 * @param message the message to print 025 */ 026 public PrintCommand(String message) { 027 super("Print(\"" + message + "\""); 028 m_message = message; 029 } 030 031 protected void initialize() { 032 System.out.println(m_message); 033 } 034}