Created
October 30, 2017 21:03
-
-
Save kauailabs/5f490442de8f387e6ae8fe24471476b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> /* printf() */ | |
| #include "VMXPi.h" | |
| int main(int argc, char *argv[]) | |
| { | |
| bool realtime = false; | |
| uint8_t update_rate_hz = 50; | |
| VMXPi vmx(realtime, update_rate_hz); | |
| if(vmx.IsOpen()) { | |
| for ( int i = 0; i < 100; i++) { | |
| /* Display System (Battery) Voltage */ | |
| float system_voltage = -1.0f; | |
| if(vmx.power.GetSystemVoltage(system_voltage)){ | |
| printf("System (Battery) Voltage: %f", system_voltage); | |
| } else { | |
| printf("Error retrieving system voltage."); | |
| } | |
| bool overcurrent; | |
| if (vmx.power.GetOvercurrent(overcurrent)) { | |
| printf("- %s\n", (overcurrent ? "OVERCURRENT" : "")); | |
| } else { | |
| printf("\n"); | |
| } | |
| vmx.time.DelayMilliseconds(10); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment