| 23 | GoPiGo3 GPG; // Create a GoPiGo3 instance |
| 24 | |
| 25 | int main(){ |
| 26 | char str[33]; // Room for the 32-character serial number string plus the NULL terminator. |
| 27 | |
| 28 | // Make sure that the GoPiGo3 is communicating and that the firmware is compatible with the drivers. |
| 29 | // pass 'false' to detect() to make the error non-critical (return the error instead of exiting the program). |
| 30 | if(GPG.detect(false) == ERROR_NONE){ |
| 31 | printf("\nGoPiGo3 info:\n"); |
| 32 | |
| 33 | GPG.get_manufacturer(str); |
| 34 | printf(" Manufacturer : %s\n", str); |
| 35 | |
| 36 | GPG.get_board(str); |
| 37 | printf(" Board : %s\n", str); |
| 38 | |
| 39 | GPG.get_id(str); |
| 40 | printf(" Serial Number : %s\n", str); |
| 41 | |
| 42 | GPG.get_version_hardware(str); |
| 43 | printf(" Hardware version: %s\n", str); |
| 44 | |
| 45 | GPG.get_version_firmware(str); |
| 46 | printf(" Firmware version: %s\n", str); |
| 47 | |
| 48 | printf(" Battery voltage : %.3f\n", GPG.get_voltage_battery()); |
| 49 | printf(" 5v voltage : %.3f\n", GPG.get_voltage_5v()); |
| 50 | }else{ |
| 51 | printf("\nError communicating with GoPiGo3\n"); |
| 52 | } |
| 53 | } |
nothing calls this directly
no test coverage detected