pxt-calliope/docs/reference/input.md

42 lines
687 B
Markdown
Raw Normal View History

2016-04-05 22:23:42 +02:00
# Input
2016-05-05 20:16:14 +02:00
Events and data from sensors
2016-04-05 22:23:42 +02:00
```cards
2016-04-05 22:54:48 +02:00
input.onButtonPressed(Button.A, () => {
2016-04-05 22:23:42 +02:00
});
2016-04-05 22:54:48 +02:00
input.onGesture(Gesture.Shake, () => {
2016-04-05 22:23:42 +02:00
});
2016-04-05 22:54:48 +02:00
input.onPinPressed(TouchPin.P0, () => {
2016-04-05 22:23:42 +02:00
});
2016-04-05 22:54:48 +02:00
input.buttonIsPressed(Button.A);
2016-04-05 22:23:42 +02:00
input.compassHeading();
input.temperature();
2016-04-05 22:54:48 +02:00
input.acceleration(Dimension.X);
2016-04-05 22:23:42 +02:00
input.lightLevel();
2016-04-05 22:54:48 +02:00
input.rotation(Rotation.Pitch);
input.magneticForce(Dimension.X);
2016-04-05 22:23:42 +02:00
input.runningTime();
2016-04-05 22:54:48 +02:00
input.setAccelerometerRange(AcceleratorRange.OneG);
input.pinIsPressed(TouchPin.P0);
2016-04-05 22:23:42 +02:00
input.calibrate();
input.onLogoDown(() => {
});
input.onLogoUp(() => {
});
input.onScreenDown(() => {
});
input.onScreenUp(() => {
});
input.onShake(() => {
});
```