1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
-
-
- #include <unistd.h>
- #include <iostream>
- #include "tcs3414cs.h"
- #include <signal.h>
-
- int doWork = 0;
- upm::TCS3414CS *sensor = NULL;
-
- void
- sig_handler(int signo)
- {
- printf("got signal\n");
- if (signo == SIGINT) {
- printf("exiting application\n");
- doWork = 1;
- }
- }
-
- int
- main(int argc, char **argv)
- {
-
- upm::tcs3414sc_rgb_t rgb;
- sensor = new upm::TCS3414CS ();
-
- while (!doWork) {
- sensor->readRGB (&rgb);
- std::cout << (int)rgb.r << ", " << (int)rgb.g << ", " << (int)rgb.b << ", " << rgb.clr << std::endl;
- usleep (500000);
- }
-
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
- }
|