new class LightningChecker to control led
This commit is contained in:
parent
09c045fd2e
commit
ac9327179d
48
src/LightingChecker.cpp
Normal file
48
src/LightingChecker.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#include <header.h>
|
||||||
|
|
||||||
|
#define RED_PIN 1
|
||||||
|
#define GREEN_PIN 2
|
||||||
|
#define BLUE_PIN 3
|
||||||
|
|
||||||
|
enum colorTypes {
|
||||||
|
purple,
|
||||||
|
blue,
|
||||||
|
green,
|
||||||
|
yellow,
|
||||||
|
orange,
|
||||||
|
red,
|
||||||
|
white
|
||||||
|
};
|
||||||
|
|
||||||
|
int valueNM;
|
||||||
|
|
||||||
|
colorTypes color = white;
|
||||||
|
|
||||||
|
void readPreferableLight() {
|
||||||
|
//preferableLight = Read from database
|
||||||
|
}
|
||||||
|
|
||||||
|
void getColorBasedOnPreferableLight() {
|
||||||
|
if (valueNM <= 420) {
|
||||||
|
color = purple;
|
||||||
|
}
|
||||||
|
else if (valueNM <= 490) {
|
||||||
|
color = blue;
|
||||||
|
}
|
||||||
|
else if (valueNM <= 575) {
|
||||||
|
color = green;
|
||||||
|
}
|
||||||
|
else if (valueNM <= 585) {
|
||||||
|
color = yellow;
|
||||||
|
}
|
||||||
|
else if (valueNM <= 650) {
|
||||||
|
color = orange;
|
||||||
|
}
|
||||||
|
else if (valueNM <= 750) {
|
||||||
|
color = red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void activateLight(int duration) {
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user