Skip to first unread message

Quentin Sanders

unread,
Jan 9, 2016, 1:52:22 AM1/9/16
to MIT App Inventor Forum
Hello I am currently trying to make a stopwatch using app inventor 2.  I need the stopwatch to be accurate to 1/1000th of a second.  I have been able to get it to be accurate to a 1/100th of a second, but anytime I try to make the stopwatch more accurate it runs far to slow.  Does anyone know anyways to solve this problem?  Thanks. 

SteveJG

unread,
Jan 9, 2016, 9:08:51 AM1/9/16
to mitappinv...@googlegroups.com
Probably not possible Quentin  ... see  http://gamasutra.com/view/feature/171774/getting_high_precision_timing_on_.php?print=1  there might be something there you can use.

An additional problem is that that the AI2 graphics are notoriously slow when compared with apps built with Java based compilers.  If you post the timing data to the screen in real time, there will be a lag.  This might be mitigated by posting only the beginning and ending time, without the intervening  1/1000th seconds.  Realize 1/1000 is —300x faster than a human blink

Taifun

unread,
Jan 9, 2016, 10:08:52 AM1/9/16
to MIT App Inventor Forum
you will get the best result, if after starting you store the start time and in the end calculate end time - start time
Taifun

Quentin Sanders

unread,
Jan 11, 2016, 6:53:08 PM1/11/16
to MIT App Inventor Forum
Would you happen to have an example of what that would look like? 

Quentin Sanders

unread,
Jan 11, 2016, 6:53:38 PM1/11/16
to MIT App Inventor Forum
@Taifun

Taifun

unread,
Jan 11, 2016, 7:33:05 PM1/11/16
to MIT App Inventor Forum

Quentin Sanders

unread,
Jan 11, 2016, 7:46:48 PM1/11/16
to MIT App Inventor Forum
Scott's method is the method that I tried initially, and how my code currently looks now more or less. I had tried modifying that code so that it only showed seconds and milliseconds.  But it always seemed to run to slow or would never match up correctly with the clock on my computer. 

Scott Ferguson

unread,
Jan 12, 2016, 1:20:39 AM1/12/16
to mitappinv...@googlegroups.com
This example shows how I would attempt to set a counter for 100ths of a second.
The Clock component is set to an interval of 0.
Set Label3.Text to 0 initially.
---
sf

Elapsed100ths.aia
Capture.PNG
Reply all
Reply to author
Forward
0 new messages