-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMoteursDC.h
67 lines (58 loc) · 952 Bytes
/
MoteursDC.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef Moteur_DC_H
#define Moteur_DC_H
#include <Arduino.h>
#include <stdbool.h>
#include <math.h>
#define Port1A 0x00
#define Port1B 0x01
#define Port2A 0x02
#define Port2B 0x03
#define Port3A 0x04
#define Port3B 0x05
#define Port4A 0x06
#define Port4B 0x07
typedef struct
{
uint8_t pin_PWM;
uint8_t pin_H1;
uint8_t pin_H2;
} DC_port_type;
class MotorDC
{
public:
//Constructeur
MotorDC();
MotorDC(uint8_t port);
void run(int pwm);
virtual void stop(void);
protected:
;
uint8_t _Slot;
uint8_t _Port;
uint8_t _PIN_PWM;
uint8_t _PIN_H1;
uint8_t _PIN_H2;
};
class Pince: public MotorDC
{
public:
//Constructeur
Pince();
Pince(uint8_t port);
void open(int pwm=200);
void close(int pwm=150);
};
class Bras: public MotorDC
{
public:
//Constructeur
Bras();
Bras(uint8_t port);
virtual void stop();
void up(int pwm=200);
void down(int pwm=100);
uint8_t getState(void);
private:
uint8_t _State;
};
#endif