-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLed.cpp
More file actions
30 lines (25 loc) · 702 Bytes
/
Led.cpp
File metadata and controls
30 lines (25 loc) · 702 Bytes
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
#include "Led.h"
#include <cstdint>
Led::Led()
: greenLed(LED1), blueLed(LED2), redLed(LED3) {
redLed.period(0.001f);
greenLed.period(0.001f);
blueLed.period(0.001f);
off();
}
void Led::setBrightness(float redBrightness, float greenBrightness, float blueBrightness) {
redLed = redBrightness;
greenLed = greenBrightness;
blueLed = blueBrightness;
}
void Led::off() {
redLed = 0.0f;
greenLed = 0.0f;
blueLed = 0.0f;
}
void Led::trickyLeds(Random * random) {
uint16_t randomPwm = random->randomNumberOnInterval(5, 10);
this->redLed = (float)randomPwm / 10;
this->greenLed = (float)randomPwm / 10;
this->blueLed = (float)randomPwm / 10;
}