-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
50 lines (35 loc) · 851 Bytes
/
main.cpp
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
/*
* File: main.cpp
* Author: philippe SIMIER Lycée touchard Le Mans
*
* Created on 12 octobre 2024, 17:07
*/
#include <iostream>
#include "ws2812b.h"
using namespace std;
int main(int argc, char** argv) {
Color couleur[8] = {
Color::Red,
Color::Green,
Color::Blue,
Color::White,
Color::Black,
Color::Cyan,
Color::Yellow,
Color::Magenta
};
try {
WS2812b ledRGB(1); //1 pixel LED RGB
int i = 0;
while (1) {
ledRGB.setPixelColor(0, couleur[i], 0.1);
ledRGB.show();
sleep(3);
i++;
if (i == 8) i = 0;
}
} catch (const std::runtime_error &e) {
cout << "Exception caught: " << e.what() << endl;
}
return 0;
}