pxt-ev3/docs/reference/sensors.md
Galen Nickel 3a67190914
Add some 'infrared' api docs (#326)
* Add some 'infrared' api docs

* Fix display messages

* Change discussion of distance to relative

* Include motor speed note
2018-02-20 10:38:41 -08:00

36 lines
663 B
Markdown

# Sensors
## Touch
```cards
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {})
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
sensors.touch1.wasPressed()
sensors.touch1.isPressed()
```
## Gyro
```cards
sensors.gyro1.angle();
sensors.gyro1.rate();
sensors.gyro1.reset();
```
## Ultrasonic
```cards
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectDetected, function () {});
sensors.ultrasonic1.distance();
sensors.ultrasonic1.pauseUntil(UltrasonicSensorEvent.ObjectDetected);
```
## Infrared
```cards
sensors.infraredSensor1.onEvent(null, function () {});
sensors.infraredSensor1.pauseUntil(null);
sensors.infraredSensor1.proximity();
```