1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
-
-
- #include <unistd.h>
- #include <iostream>
- #include <iomanip>
- #include <signal.h>
- #include "otp538u.h"
-
- using namespace std;
-
- bool shouldRun = true;
-
-
- #define OTP538U_AREF 5.0
-
- void sig_handler(int signo)
- {
- if (signo == SIGINT)
- shouldRun = false;
- }
-
- int main()
- {
- signal(SIGINT, sig_handler);
-
-
-
-
-
-
- upm::OTP538U *temps = new upm::OTP538U(0, 1, OTP538U_AREF);
-
-
- while (shouldRun)
- {
- cout << "Ambient temp: " << std::fixed << setprecision(2)
- << temps->ambientTemperature()
- << " C, Object temp: " << temps->objectTemperature()
- << " C" << endl;
-
- sleep(1);
- }
-
-
- cout << "Exiting" << endl;
-
- delete temps;
- return 0;
- }
|