LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Battery Life in Hours

i found an example of an application that displays the laptops battery life in seconds, and I need it to be displayed in hours, mins., seconds.

Can someone please help me convert this example, so that the time can be displayed in the format stated above?

Thanks.

0 Kudos
Message 1 of 4
(2,581 Views)

The code to do that already exists in the VI you attached.  It just so happens it takes the 3 integers for hours, minutes, and seconds and converts them into a single string.  However, I think that is not doing it correctly.  Here is how it shoud be done, and also with 3 separate indicators.

 

0 Kudos
Message 2 of 4
(2,566 Views)

All you need to do is use a plain numeric indicator set to relative time format.

Almost no code needed! 😄

 

You can even include some of the other text by setting the advanced format to e.g. "Estimated Time: %<%H:%M:%S>t"

 

 

See attached modification.

 

Download All
0 Kudos
Message 3 of 4
(2,546 Views)

You already have two good answers, but i thought I'd put in a little broader insight on a very underutilized feature in LabVIEW - units. When working with time I almost always use units because I typically end up needing to do some sort of math on the value and the units make it so much easier.

Plus, units allow you to do really neat things. For instance take a value in a unit of length and divide it by a value in unit of time and the math knows you are calculating velocity, so even if you originally calculated miles per hour, you can, see the result in any other expression of velocity by simply changing the unit label on an indicator.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 4
(2,517 Views)