-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEveningMode.cpp
More file actions
34 lines (24 loc) · 760 Bytes
/
EveningMode.cpp
File metadata and controls
34 lines (24 loc) · 760 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
31
32
33
34
#include <iostream>
#include "lightbulb.h"
using namespace std;
int main() {
cout << "Connecting to lights..." << endl;
Lightbulb bulb1("192.168.1.24");
Lightbulb bulb2("192.168.1.25");
Lightbulb lamp("192.168.1.26");
cout << "Transitioning to Evening Mode..." << endl;
int duration = 30000;
if (bulb1.getConnected() && bulb1.getState().getIsOn()) {
bulb1.setAllowTimeouts(false);
bulb1.turnOn(10, duration);
}
if (bulb2.getConnected() && bulb2.getState().getIsOn()) {
bulb2.setAllowTimeouts(false);
bulb2.turnOn(10, duration);
}
if (lamp.getConnected() && lamp.getState().getIsOn()) {
lamp.setAllowTimeouts(false);
lamp.setHSB(25, 100, 10, duration);
}
cout << "Evening mode activated. Have a relaxing evening :)" << endl;
}