| 29 | void exit_signal_handler(int signo); |
| 30 | |
| 31 | int main(){ |
| 32 | signal(SIGINT, exit_signal_handler); // register the exit function for Ctrl+C |
| 33 | |
| 34 | GPG.detect(); // Make sure that the GoPiGo3 is communicating and that the firmware is compatible with the drivers. |
| 35 | |
| 36 | GPG.set_grove_type(GROVE_1, GROVE_TYPE_US); |
| 37 | GPG.set_grove_type(GROVE_2, GROVE_TYPE_IR_DI_REMOTE); |
| 38 | sensor_ultrasonic_t US; |
| 39 | sensor_infrared_gobox_t IR; |
| 40 | |
| 41 | while(true){ |
| 42 | int USerror = GPG.get_grove_value(GROVE_1, &US); |
| 43 | int IRerror = GPG.get_grove_value(GROVE_2, &IR); |
| 44 | printf("US: Error %d %4dmm IR: Error %d button %d\n", USerror, US.mm, IRerror, IR.button); |
| 45 | usleep(20000); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // Signal handler that will be called when Ctrl+C is pressed to stop the program |
| 50 | void exit_signal_handler(int signo){ |
nothing calls this directly
no test coverage detected