WPILibC++  unspecified
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 "SolenoidBase.h"
13 
14 namespace frc {
15 
22 class Solenoid : public SolenoidBase {
23  public:
24  explicit Solenoid(int channel);
25  Solenoid(int moduleNumber, int channel);
26  ~Solenoid() override;
27  virtual void Set(bool on);
28  virtual bool Get() const;
29  bool IsBlackListed() const;
30  void SetPulseDuration(double durationSeconds);
31  void StartPulse();
32 
33  void InitSendable(SendableBuilder& builder) override;
34 
35  private:
36  HAL_SolenoidHandle m_solenoidHandle = HAL_kInvalidHandle;
37  int m_channel; // The channel on the module to control
38 };
39 
40 } // namespace frc
Definition: RobotController.cpp:14
SolenoidBase class is the common base class for the Solenoid and DoubleSolenoid classes.
Definition: SolenoidBase.h:19
virtual void Set(bool on)
Set the value of a solenoid.
Definition: Solenoid.cpp:73
virtual bool Get() const
Read the current value of the solenoid.
Definition: Solenoid.cpp:85
Solenoid class for running high voltage Digital Output (PCM).
Definition: Solenoid.h:22
void StartPulse()
Trigger the PCM to generate a pulse of the duration set in setPulseDuration.
Definition: Solenoid.cpp:131
~Solenoid() override
Destructor.
Definition: Solenoid.cpp:66
Solenoid(int channel)
Constructor using the default PCM ID (0).
Definition: Solenoid.cpp:25
bool IsBlackListed() const
Check if solenoid is blacklisted.
Definition: Solenoid.cpp:103
Definition: SendableBuilder.h:23
void SetPulseDuration(double durationSeconds)
Set the pulse duration in the PCM.
Definition: Solenoid.cpp:117
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
Definition: Solenoid.cpp:138