In several sensor communications is basic to find the exact time when a pin is triggered comparing an initial state or between states (distance sensors, etc..)
Are you thinking about including these in core functions ? (like DateTime)
Yes, tried with millis,but the problem with that function is resolution (only miliseconds). In several schematics, we'll need more timing resolutions (like microseconds - Arduino function)
ex: distance sensor: measuring distance finding the time between a trigger and an echo sound (using sound speed - air - formula)
I will add it. Note that you can also call it with this code:
B4X:
Sub Process_Globals
Public Serial1 As Serial
Private microsTime As ULong 'ignore
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
RunNative("micro", Null)
Log(microsTime)
RunNative("micro", Null)
Log(microsTime)
End Sub
#if C
void micro (B4R::Object* o) {
b4r_main::_microstime = micros();
}
#End if