pxt-calliope/docs/reference/input.md
Juri Wolf 5f7a8e5301
Updates for V4 (#197)
* update yotta defaults for 16kb devices

* refactor deprecated blocks

* updates for button events

* update button events

* update refference

* update docs

* update docs

* update button event blocks

* update docs

* update block id
2022-08-10 09:36:19 -07:00

1.3 KiB

Input

Events and data from sensors

input.onButtonEvent(Button.A, input.buttonEventClick(), function () {})
input.onGesture(Gesture.Shake, function () {})
input.onPinEvent(TouchPin.P0, input.buttonEventDown(), function() {})
input.buttonIsPressed(Button.A)
input.pinIsPressed(TouchPin.P0)
input.isGesture(Gesture.Shake)
input.compassHeading()
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

On Button Event, onGesture, On Pin Event, buttonIsPressed, pinIsPressed, is gesture, compassHeading, temperature, acceleration, lightLevel, rotation, magneticForce, runningTime, setAccelerometerRange, calibrate-compass