WPILibC++  2018.4.1-20180921123319-1190-ge210073
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Solenoid.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-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/SolenoidBase.h"
13 
14 namespace frc {
15 
22 class Solenoid : public SolenoidBase {
23  public:
29  explicit Solenoid(int channel);
30 
37  Solenoid(int moduleNumber, int channel);
38 
39  ~Solenoid() override;
40 
46  virtual void Set(bool on);
47 
53  virtual bool Get() const;
54 
65  bool IsBlackListed() const;
66 
77  void SetPulseDuration(double durationSeconds);
78 
85  void StartPulse();
86 
87  void InitSendable(SendableBuilder& builder) override;
88 
89  private:
90  HAL_SolenoidHandle m_solenoidHandle = HAL_kInvalidHandle;
91  int m_channel; // The channel on the module to control
92 };
93 
94 } // namespace frc
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
SolenoidBase class is the common base class for the Solenoid and DoubleSolenoid classes.
Definition: SolenoidBase.h:19
void StartPulse()
Trigger the PCM to generate a pulse of the duration set in setPulseDuration.
virtual void Set(bool on)
Set the value of a solenoid.
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
Solenoid class for running high voltage Digital Output (PCM).
Definition: Solenoid.h:22
virtual bool Get() const
Read the current value of the solenoid.
void SetPulseDuration(double durationSeconds)
Set the pulse duration in the PCM.
Definition: SendableBuilder.h:23
bool IsBlackListed() const
Check if solenoid is blacklisted.
Solenoid(int channel)
Constructor using the default PCM ID (0).