1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
iTokenSec : integer;
...
TThread.CreateAnonymousThread(procedure ()
var
MyStopWatch: TStopwatch;
M, S, OldM, OldS: Word;
DtTimer: TDateTime;
acx, acy: single;
begin
MyStopWatch := TStopwatch.StartNew;
while True do
begin
TThread.Synchronize (TThread.CurrentThread,procedure ()
begin
S := Trunc(MyStopWatch.Elapsed.Seconds);
M := Trunc(MyStopWatch.Elapsed.Minutes);
if S <> OldS then
begin
OldS := S;
inc(iTokenSec);
Label1.Text := 'Watch sec>' + inttostr(S);
acx := MotionSensor1.Sensor.AccelerationX;
acy := MotionSensor1.Sensor.AccelerationY;
MotionStatusCheck(acx,acy);
if M <> OldM then
begin
Label2.Text := 'Watch min>' + inttostr(M);
OldM := M;
inc(iDrawPoint);
arX[iDrawPoint] := acx;
arY[iDrawPoint] := acy;
DrawMotion; // dessin sur PlotGrid1
end;
end;
end);
sleep(1);
end;
end).Start; |
Partager