|Top Previous Next|
Gets the value of millisecond counter.
A positive integer count of milliseconds.
The milliseconds count is from a free-running counter, not synchronized with the time-of-day clock (DateTime.now function). It rolls over back to zero approximately every 25 days. It counts in 2ms increments.
The count rate is affected by the adjustment property.
// Wait for PortB bit 0, time out after 40ms
var start, dif, input;
start = System.Clock.getMilliseconds();
// Mask out sign bit after subtracting
dif = (System.Clock.getMilliseconds() - start) & 0x7FFFFFFF;
input = Cell.PortB.pins & 0x01;
} while (input == 0 && dif < 40);