pxt-calliope/docs/reference/input.md

34 lines
1.3 KiB
Markdown
Raw Permalink 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
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
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
});
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Click, () => {
2016-04-05 22:23:42 +02:00
});
2016-04-05 22:54:48 +02:00
input.buttonIsPressed(Button.A);
input.isGesture(Gesture.Shake);
2016-04-05 22:23:42 +02:00
input.compassHeading();
input.pinIsPressed(TouchPin.P0);
2016-04-05 22:23:42 +02:00
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();
input.runningTimeMicros();
2016-04-05 22:54:48 +02:00
input.setAccelerometerRange(AcceleratorRange.OneG);
2016-04-05 22:23:42 +02:00
```
2016-08-08 22:08:15 +02:00
## See also
2016-08-08 22:08:15 +02:00
[onButtonPressed](/reference/input/on-button-pressed), [onGesture](/reference/input/on-gesture), [onPinPressed](/reference/input/on-pin-pressed), [buttonIsPressed](/reference/input/button-is-pressed),
[is gesture](/reference/input/is-gesture),
[compassHeading](/reference/input/compass-heading), [pinIsPressed](/reference/input/pin-is-pressed), [temperature](/reference/input/temperature), [acceleration](/reference/input/acceleration), [lightLevel](/reference/input/light-level), [rotation](/reference/input/rotation), [magneticForce](/reference/input/magnetic-force), [runningTime](/reference/input/running-time), [setAccelerometerRange](/reference/input/set-accelerometer-range), [calibrate-compass](/reference/input/calibrate-compass)