pxt-calliope/docs/reference/input.md
Peli de Halleux bd895f43ba Calibrate compass (#392)
* adding 'calibrate-compass' function

* fixing simulator.

* updated docs

* fixing compat test suite with 'calibrate()' function
2017-04-25 10:46:25 -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.compassHeading();
input.pinIsPressed(TouchPin.P0);
input.temperature();
input.acceleration(Dimension.X);
input.lightLevel();
input.rotation(Rotation.Pitch);
input.magneticForce(Dimension.X);
input.runningTime();
input.setAccelerometerRange(AcceleratorRange.OneG);
input.onLogoDown(() => {
    
});
input.onLogoUp(() => {
    
});
input.onScreenDown(() => {
    
});
input.onScreenUp(() => {
    
});
input.onShake(() => {
    
});

See Also

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