WPILibC++ 2024.3.2
AnalogOutput.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <hal/Types.h>
10
11namespace frc {
12
13/**
14 * MXP analog output class.
15 */
17 public wpi::SendableHelper<AnalogOutput> {
18 public:
19 /**
20 * Construct an analog output on the given channel.
21 *
22 * All analog outputs are located on the MXP port.
23 *
24 * @param channel The channel number on the roboRIO to represent.
25 */
26 explicit AnalogOutput(int channel);
27
28 ~AnalogOutput() override;
29
32
33 /**
34 * Set the value of the analog output.
35 *
36 * @param voltage The output value in Volts, from 0.0 to +5.0.
37 */
38 void SetVoltage(double voltage);
39
40 /**
41 * Get the voltage of the analog output.
42 *
43 * @return The value in Volts, from 0.0 to +5.0.
44 */
45 double GetVoltage() const;
46
47 /**
48 * Get the channel of this AnalogOutput.
49 */
50 int GetChannel() const;
51
52 void InitSendable(wpi::SendableBuilder& builder) override;
53
54 protected:
57};
58
59} // namespace frc
MXP analog output class.
Definition: AnalogOutput.h:17
AnalogOutput(AnalogOutput &&)=default
AnalogOutput & operator=(AnalogOutput &&)=default
void InitSendable(wpi::SendableBuilder &builder) override
Initializes this Sendable object.
int GetChannel() const
Get the channel of this AnalogOutput.
void SetVoltage(double voltage)
Set the value of the analog output.
~AnalogOutput() override
hal::Handle< HAL_AnalogOutputHandle > m_port
Definition: AnalogOutput.h:56
AnalogOutput(int channel)
Construct an analog output on the given channel.
int m_channel
Definition: AnalogOutput.h:55
double GetVoltage() const
Get the voltage of the analog output.
Helper class for building Sendable dashboard representations.
Definition: SendableBuilder.h:21
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:19
Interface for Sendable objects.
Definition: Sendable.h:16
Definition: AprilTagPoseEstimator.h:15