// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package org.wpilib.snippets.dutycycleinput;

import org.wpilib.framework.TimedRobot;
import org.wpilib.hardware.rotation.DutyCycle;
import org.wpilib.smartdashboard.SmartDashboard;

public class Robot extends TimedRobot {
  private final DutyCycle dutyCycle;

  public Robot() {
    dutyCycle = new DutyCycle(0);
  }

  @Override
  public void robotPeriodic() {
    // Duty Cycle Frequency in Hz
    double frequency = dutyCycle.getFrequency();

    // Output of duty cycle, ranging from 0 to 1
    // 1 is fully on, 0 is fully off
    double output = dutyCycle.getOutput();

    SmartDashboard.putNumber("Frequency", frequency);
    SmartDashboard.putNumber("Duty Cycle", output);
  }
}
