WPILibC++  2018.4.1-20180926150325-1206-g8b1274d
 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 
41  Solenoid(Solenoid&& rhs);
42  Solenoid& operator=(Solenoid&& rhs);
43 
49  virtual void Set(bool on);
50 
56  virtual bool Get() const;
57 
68  bool IsBlackListed() const;
69 
80  void SetPulseDuration(double durationSeconds);
81 
88  void StartPulse();
89 
90  void InitSendable(SendableBuilder& builder) override;
91 
92  private:
93  HAL_SolenoidHandle m_solenoidHandle = HAL_kInvalidHandle;
94  int m_channel; // The channel on the module to control
95 };
96 
97 } // 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).