WPILibC++  2019.1.1-beta-3-2-g4159660
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
AnalogOutput.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2014-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <hal/Types.h>
11 
12 #include "frc/ErrorBase.h"
13 #include "frc/smartdashboard/SendableBase.h"
14 
15 namespace frc {
16 
20 class AnalogOutput : public ErrorBase, public SendableBase {
21  public:
29  explicit AnalogOutput(int channel);
30 
31  ~AnalogOutput() override;
32 
34  AnalogOutput& operator=(AnalogOutput&& rhs);
35 
41  void SetVoltage(double voltage);
42 
48  double GetVoltage() const;
49 
53  int GetChannel();
54 
55  void InitSendable(SendableBuilder& builder) override;
56 
57  protected:
58  int m_channel;
59  HAL_AnalogOutputHandle m_port = HAL_kInvalidHandle;
60 };
61 
62 } // namespace frc
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
AnalogOutput(int channel)
Construct an analog output on the given channel.
int GetChannel()
Get the channel of this AnalogOutput.
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
MXP analog output class.
Definition: AnalogOutput.h:20
Base class for most objects.
Definition: ErrorBase.h:74
Definition: SendableBase.h:19
Definition: SendableBuilder.h:23
void SetVoltage(double voltage)
Set the value of the analog output.
double GetVoltage() const
Get the voltage of the analog output.