001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.wpilibj.xrp; 006 007import edu.wpi.first.wpilibj.DigitalInput; 008import edu.wpi.first.wpilibj.DigitalOutput; 009 010/** 011 * This class represents the onboard IO of the XRP Reference Robot. This includes the USER 012 * pushbutton and LED 013 */ 014public class XRPOnBoardIO { 015 private final DigitalInput m_button = new DigitalInput(0); 016 private final DigitalOutput m_led = new DigitalOutput(1); 017 018 /** Constructor. */ 019 public XRPOnBoardIO() { 020 // No need to do anything else. Unlike the Romi, there are no other configurable 021 // I/O ports 022 } 023 024 /** 025 * Gets if the USER button is pressed. 026 * 027 * @return True if the USER button is currently pressed. 028 */ 029 public boolean getUserButtonPressed() { 030 return m_button.get(); 031 } 032 033 /** 034 * Sets the onboard LED. 035 * 036 * @param value True to activate LED, false otherwise. 037 */ 038 public void setLed(boolean value) { 039 m_led.set(value); 040 } 041 042 /** 043 * Gets state of the onboard LED. 044 * 045 * @return True if LED is active, false otherwise. 046 */ 047 public boolean getLed() { 048 return m_led.get(); 049 } 050}