123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
-
-
- #include <unistd.h>
- #include <iostream>
- #include <signal.h>
- #include "guvas12d.h"
-
- using namespace std;
-
- bool shouldRun = true;
-
-
- #define GUVAS12D_AREF 5.0
- #define SAMPLES_PER_QUERY 1024
-
- void sig_handler(int signo)
- {
- if (signo == SIGINT)
- shouldRun = false;
- }
-
- int main()
- {
- signal(SIGINT, sig_handler);
-
-
-
-
-
-
-
- upm::GUVAS12D *volts = new upm::GUVAS12D(0);
-
-
-
- while (shouldRun)
- {
- cout << "AREF: " << GUVAS12D_AREF
- << ", Voltage value (higher means more UV): "
- << volts->value(GUVAS12D_AREF, SAMPLES_PER_QUERY) << endl;
-
- sleep(1);
- }
-
-
- cout << "Exiting" << endl;
-
- delete volts;
- return 0;
- }
|