13. Utilisation du Yocto-3D-V2 avec Android
aa.notifyDataSetChanged();
handler.postDelayed(r,
}
@Override
protected
void
{
super.onStop();
handler.removeCallbacks(r);
YAPI.FreeAPI();
}
@Override
public
void
onItemSelected(AdapterView<?>
{
serial
= parent.getItemAtPosition(pos).toString();
}
@Override
public
void
onNothingSelected(AdapterView<?> arg0)
{
}
final
Runnable
{
public
void
{
if
(serial
YSensor
try {
tilt1.getUnit()));
} catch
}
YTilt
try {
tilt2.getUnit()));
} catch
}
YCompass
try {
compass.getUnit()));
} catch
}
YAccelerometer
".accelerometer");
try {
accelerometer.getUnit()));
} catch
}
YGyro
try {
gyro.getUnit()));
} catch
}
}
handler.postDelayed(this,
}
};
}
96
500);
onStop()
r
= new Runnable()
run()
!= null) {
tilt1
=
YTilt.FindTilt(serial
TextView view
= (TextView) findViewById(R.id.tilt1field);
view.setText(String.format("%.1f
(YAPI_Exception
e.printStackTrace();
tilt2
=
YTilt.FindTilt(serial
TextView view
= (TextView) findViewById(R.id.tilt2field);
view.setText(String.format("%.1f
(YAPI_Exception
e.printStackTrace();
compass
=
YCompass.FindCompass(serial
TextView view
= (TextView) findViewById(R.id.compassfield);
view.setText(String.format("%.1f
(YAPI_Exception
e.printStackTrace();
accelerometer
TextView view
= (TextView) findViewById(R.id.accelfield);
view.setText(String.format("%.1f
(YAPI_Exception
e.printStackTrace();
gyro
=
YGyro.FindGyro(serial
TextView view
= (TextView) findViewById(R.id.gyrofield);
view.setText(String.format("%.1f
(YAPI_Exception
e.printStackTrace();
200);
parent,
View
view,
+ ".tilt1");
%s", tilt1.getCurrentValue(),
e) {
+ ".tilt2");
%s", tilt2.getCurrentValue(),
e) {
%s", compass.getCurrentValue(),
e) {
=
YAccelerometer.FindAccelerometer(serial
%s", accelerometer.getCurrentValue(),
e) {
+ ".gyro");
%s", gyro.getCurrentValue(),
e) {
int
pos,
long
id)
+ ".compass");
www.yoctopuce.com
+