-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path10_colorDetect.cpp
More file actions
39 lines (32 loc) · 968 Bytes
/
10_colorDetect.cpp
File metadata and controls
39 lines (32 loc) · 968 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
35
36
37
38
39
/* File: 10_colorDetect.cpp
* Author: Philippe Latu
* Source: https://github.com/platu/libsensehat-cpp
*
* This example program illustrates color detection with the TCS34725 Adafruit
* module
*
* Function prototypes:
*
*/
#include <iostream>
#include <iomanip>
#include <chrono>
#include <thread>
#include <cstdlib>
#include <sensehat.h>
using namespace std;
using namespace std::this_thread; // sleep_for, sleep_until
using namespace std::chrono; // system_clock, milliseconds
int main() {
if (senseInit()) {
cout << "-------------------------------" << endl
<< "Sense Hat initialization Ok." << endl;
if (colorDetectInit(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_1X)) {
cout << "Color detection initialization." << endl;
}
senseShutdown();
cout << "-------------------------------" << endl
<< "Sense Hat shut down." << endl;
}
return EXIT_SUCCESS;
}