Skip to content

Instantly share code, notes, and snippets.

@kauailabs
Created October 30, 2017 21:03
Show Gist options
  • Select an option

  • Save kauailabs/5f490442de8f387e6ae8fe24471476b3 to your computer and use it in GitHub Desktop.

Select an option

Save kauailabs/5f490442de8f387e6ae8fe24471476b3 to your computer and use it in GitHub Desktop.
#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