WPILibC++ 2025.3.2
Loading...
Searching...
No Matches
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/AnalogOutput.h>
8#include <hal/Types.h>
11
12namespace frc {
13
14/**
15 * MXP analog output class.
16 */
18 public wpi::SendableHelper<AnalogOutput> {
19 public:
20 /**
21 * Construct an analog output on the given channel.
22 *
23 * All analog outputs are located on the MXP port.
24 *
25 * @param channel The channel number on the roboRIO to represent.
26 */
27 explicit AnalogOutput(int channel);
28
31
32 ~AnalogOutput() override = default;
33
34 /**
35 * Set the value of the analog output.
36 *
37 * @param voltage The output value in Volts, from 0.0 to +5.0.
38 */
39 void SetVoltage(double voltage);
40
41 /**
42 * Get the voltage of the analog output.
43 *
44 * @return The value in Volts, from 0.0 to +5.0.
45 */
46 double GetVoltage() const;
47
48 /**
49 * Get the channel of this AnalogOutput.
50 */
51 int GetChannel() const;
52
53 void InitSendable(wpi::SendableBuilder& builder) override;
54
55 protected:
58};
59
60} // namespace frc
MXP analog output class.
Definition AnalogOutput.h:18
AnalogOutput(AnalogOutput &&)=default
AnalogOutput & operator=(AnalogOutput &&)=default
~AnalogOutput() override=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.
hal::Handle< HAL_AnalogOutputHandle, HAL_FreeAnalogOutputPort > m_port
Definition AnalogOutput.h:57
AnalogOutput(int channel)
Construct an analog output on the given channel.
int m_channel
Definition AnalogOutput.h:56
double GetVoltage() const
Get the voltage of the analog output.
A move-only C++ wrapper around a HAL handle.
Definition Types.h:96
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:21
Interface for Sendable objects.
Definition Sendable.h:16
Definition CAN.h:11