12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
-
-
- #include <unistd.h>
- #include <iostream>
- #include <signal.h>
- #include <stdlib.h>
- #include "ecs1030.h"
-
- int is_running = 0;
- upm::ECS1030 *sensor = NULL;
-
- void
- sig_handler(int signo)
- {
- printf("got signal\n");
- if (signo == SIGINT) {
- is_running = 1;
- }
- }
-
-
- int
- main(int argc, char **argv)
- {
- sensor = new upm::ECS1030(0);
- signal(SIGINT, sig_handler);
-
- while (!is_running) {
- std::cout << "I = " << sensor->getCurrency_A () << ", Power = " << sensor->getPower_A () << std::endl;
- std::cout << "I = " << sensor->getCurrency_B () << ", Power = " << sensor->getPower_B () << std::endl;
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
- }
|