| 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_CUSTOM); |
| 37 | GPG.set_grove_mode(GROVE_1_1, OUTPUT_PWM); |
| 38 | |
| 39 | int8_t i = 0; |
| 40 | int8_t a = 1; |
| 41 | while(true){ |
| 42 | GPG.set_grove_pwm_duty(GROVE_1_1, i); |
| 43 | i += a; |
| 44 | if(i == 100 || i == 0){ |
| 45 | a *= -1; |
| 46 | } |
| 47 | usleep(5000); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // Signal handler that will be called when Ctrl+C is pressed to stop the program |
| 52 | void exit_signal_handler(int signo){ |
nothing calls this directly
no test coverage detected