pxt-calliope/docs/reference/input.md
Peli de Halleux d640dc5eed
support for is-gesture (#1873)
* support for is-gesture

* updated shims

* activate shake button

* refactor

* refactor shake button
2019-03-21 07:40:23 -07:00

1.3 KiB

Input

Events and data from sensors

input.onButtonPressed(Button.A, () => {
    
});
input.onGesture(Gesture.Shake, () => {
    
});
input.onPinPressed(TouchPin.P0, () => {
    
});
input.buttonIsPressed(Button.A);
input.isGesture(Gesture.Shake);
input.compassHeading();
input.pinIsPressed(TouchPin.P0);
input.temperature();
input.acceleration(Dimension.X);
input.lightLevel();
input.rotation(Rotation.Pitch);
input.magneticForce(Dimension.X);
input.runningTime();
input.runningTimeMicros();
input.setAccelerometerRange(AcceleratorRange.OneG);

See also

onButtonPressed, onGesture, onPinPressed, buttonIsPressed, is gesture, compassHeading, pinIsPressed, temperature, acceleration, lightLevel, rotation, magneticForce, runningTime, setAccelerometerRange, calibrate-compass