Yoctopuce Yocto-Inclinometer Mode D'emploi page 145

Table des Matières

Publicité

program
helloworld;
{$APPTYPE CONSOLE}
uses
SysUtils,
Windows,
yocto_api,
yocto_tilt;
Procedure
Usage();
var
exe : string;
begin
exe:= ExtractFileName(paramstr(0));
WriteLn(exe+'
WriteLn(exe+'
WriteLn(exe+'
halt;
End;
var
m
: TYmodule;
anytilt,tilt1,tilt2,tilt3
errmsg,serial : string;
done
: boolean;
count
: integer;
begin
if (paramcount<1) then
// Setup the API to use local USB devices
if
yRegisterHub('usb', errmsg)<>YAPI_SUCCESS
begin
Write('RegisterHub error:
exit;
end;
if
paramstr(1)='any'
begin
// lets try to find the first available tilt sensor
anytilt := yFirstTilt();
if anytilt=nil then
begin
writeln('No module connected (check USB
halt;
end
end
else
// or the one specified on command line
anytilt:= YFindTilt(paramstr(1)+'.tilt1');
// make sure it is online
if
not anytilt.isOnline() then
begin
writeln('No module connected (check USB
halt;
end;
// lets find the parent module so we can get the other sensors
m
:=
anytilt.get_module();
serial :=
m.get_serialNumber();
// retreive some sensors present on the yocto-3D
tilt1
:= yFindTilt(serial+'.tilt1');
tilt2
:= yFindTilt(serial+'.tilt2');
tilt3
:= yFindTilt(serial+'.tilt3');
// let's poll
done := false;
count :=0;
repeat
if (tilt1.isOnline()) then
begin
if
(count
mod 10=0) then
Write(FloatToStr(tilt1.get_currentValue())+#9);
Write(FloatToStr(tilt2.get_currentValue())+#9);
Write(FloatToStr(tilt3.get_currentValue())+#9);
www.yoctopuce.com
<serial_number>');
<logical_name>');
any');
: TYTilt;
usage();
'+errmsg);
then
Writeln('tilt1'#9'tilt2'#9'tilt3');
18. Utilisation du Yocto-Inclinometer en Delphi
then
cable)');
cable)');
139

Publicité

Table des Matières
loading

Ce manuel est également adapté pour:

Yclinom1

Table des Matières