SmartVehicle-Basis
SmartFactory
Hoist.h
Go to the documentation of this file.
1 
16 #ifndef Hoist_h
17 #define Hoist_h
18 
19 #include "LogConfiguration.h"
20 
21 #include <Servo.h>
22 #include "Arduino.h"
23 
28 class Hoist {
29  //=====PUBLIC====================================================================================
30  public:
31  Hoist();
40  Hoist(int hoistServoPin, int hoistServoDelay, int posMax, int posMin);
41 
46  void init();
47 
54  bool raise();
55 
61  bool lower();
62 
67  inline void attach() {
68  DBFUNCCALLln("Hoist::attach()");
69  hoistServo.attach(servoPin);
70  }
71 
76  inline void detach() {
77  DBFUNCCALLln("Hoist::detach()");
78  hoistServo.detach();
79  }
80  //=====PRIVATE====================================================================================
81  private:
82  Servo hoistServo;
83  int servoPin;
84  int position;
87  int servoDelay;
88 
89  unsigned long currentMillis = 0;
90  unsigned long previousMillis = 0;
91 };
92 
93 #endif
void detach()
detach servo from servopin
Definition: Hoist.h:76
void init()
Initialise the Hoist in the low position.
Definition: Hoist.cpp:34
Provides the basic functions to control the Hoist.
Definition: Hoist.h:28
bool lower()
Lower the Hoist 1° per servodelay/call until it's at positionMin.
Definition: Hoist.cpp:59
unsigned long currentMillis
will store current time for non blocking delay
Definition: Hoist.h:89
int servoDelay
delay in ms between raise/lower per 1 degree. This sets the servospeed
Definition: Hoist.h:87
int positionMin
minimal possible position (Hardware-Restriction)
Definition: Hoist.h:85
int positionMax
maximal possible position (Hardware-Restriction)
Definition: Hoist.h:86
int position
actual servo-position
Definition: Hoist.h:84
Servo hoistServo
Instance of servo object.
Definition: Hoist.h:82
int servoPin
Servopin.
Definition: Hoist.h:83
void attach()
attache servo to servopin
Definition: Hoist.h:67
unsigned long previousMillis
will store last time called for non blocking delay
Definition: Hoist.h:90