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

34 lines
1.3 KiB
Markdown

# Input
Events and data from sensors
```cards
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](/reference/input/on-button-event), [onGesture](/reference/input/on-gesture),
[On Pin Event](/reference/input/on-pin-event),
[buttonIsPressed](/reference/input/button-is-pressed), [pinIsPressed](/reference/input/pin-is-pressed),
[is gesture](/reference/input/is-gesture),
[compassHeading](/reference/input/compass-heading), [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)