12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
-
-
- #include <unistd.h>
- #include <iostream>
- #include <signal.h>
- #include "lol.h"
- #include <stdlib.h>
- #include <sys/time.h>
-
- int is_running = 0;
- upm::LoL *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::LoL();
- signal(SIGINT, sig_handler);
-
- unsigned char *buffer;
-
- int x = 0, y = 0;
- while (!is_running) {
- sensor->setPixel(x, y, !(sensor->getPixel(x, y)));
- if (++x == 13) { x = 0; y++; }
- if (y == 9) y = 0;
- usleep(10000);
- }
-
- std::cout << "exiting application" << std::endl;
-
- delete sensor;
-
- return 0;
- }
|