123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
-
-
- #include <unistd.h>
- #include <iostream>
- #include <signal.h>
- #include "yg1006.h"
-
- using namespace std;
-
- int shouldRun = true;
-
- void sig_handler(int signo)
- {
- if (signo == SIGINT)
- shouldRun = false;
- }
-
-
- int main ()
- {
- signal(SIGINT, sig_handler);
-
-
-
- upm::YG1006* flame = new upm::YG1006(2);
-
-
- while (shouldRun)
- {
- bool val = flame->flameDetected();
- if (val)
- cout << "Flame detected." << endl;
- else
- cout << "No flame detected." << endl;
-
- sleep(1);
- }
-
-
- cout << "Exiting..." << endl;
-
- delete flame;
- return 0;
- }
|