MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / main

Function main

Software/C/Examples/info.cpp:25–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23GoPiGo3 GPG; // Create a GoPiGo3 instance
24
25int 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}

Callers

nothing calls this directly

Calls 8

detectMethod · 0.80
get_manufacturerMethod · 0.45
get_boardMethod · 0.45
get_idMethod · 0.45
get_version_hardwareMethod · 0.45
get_version_firmwareMethod · 0.45
get_voltage_batteryMethod · 0.45
get_voltage_5vMethod · 0.45

Tested by

no test coverage detected