123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
-
-
- #include <unistd.h>
- #include <iostream>
- #include <signal.h>
- #include "maxsonarez.h"
-
- using namespace std;
-
- bool shouldRun = true;
-
- #define MAXSONAREZ_AREF 5.0
-
- void sig_handler(int signo)
- {
- if (signo == SIGINT)
- shouldRun = false;
- }
-
- int main()
- {
- signal(SIGINT, sig_handler);
-
-
-
-
-
- upm::MAXSONAREZ *sonar = new upm::MAXSONAREZ(1, MAXSONAREZ_AREF);
-
-
-
-
-
-
-
- while (shouldRun)
- {
- cout << "AREF: " << MAXSONAREZ_AREF
- << ", distance in inches: " << sonar->inches() << endl;
-
- sleep(1);
- }
-
-
-
- cout << "Exiting" << endl;
-
- delete sonar;
- return 0;
- }
|