-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRGB_LED.hpp
More file actions
71 lines (58 loc) · 1.23 KB
/
Copy pathRGB_LED.hpp
File metadata and controls
71 lines (58 loc) · 1.23 KB
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
67
68
69
70
71
/*!
* \class A4988
* \file A4988.hpp
* \brief Class for A4988 servo motor control board
*
* \author Michael Pillon
*
*/
#include "mbed.h"
#ifndef RGB_LED_hpp
#define RGB_LED_hpp
/*!
RGB_LED
For control of RGB LEDs
*/
class RGB_LED {
public:
/*!
Common cathode = 0
LED_ON = 1, LED_OFF = 0
Common anode = 1
LED_ON = 0, LED_OFF = 1
*/
enum Type { COMMON_CATHODE = 0, COMMON_ANODE };
const Type type;
const bool LED_ON;
const bool LED_OFF;
/*!
Magenta = red + blue
Yellow = red + green
Cyan = green + blue
White = red + green + blue
*/
enum State { OFF, RED, GREEN, BLUE, MAGENTA, YELLOW, CYAN, WHITE };
private:
DigitalOut redLED;
DigitalOut greenLED;
DigitalOut blueLED;
State currentState;
public:
/*!
Constructor
\param red Pin for red segment
\param green Pin for green segment
\param blue PIN for pin segment
*/
RGB_LED(Type type, PinName redPin, PinName greenPin, PinName bluePin);
void setRed(void);
void setGreen(void);
void setBlue(void);
void setMagenta(void);
void setYellow(void);
void setCyan(void);
void setWhite(void);
void setOff(void);
State getCurrentSate(void);
};
#endif