diff --git a/docs/examples/happy-unhappy.md b/docs/examples/happy-unhappy.md index 4391948e..b799a97d 100644 --- a/docs/examples/happy-unhappy.md +++ b/docs/examples/happy-unhappy.md @@ -9,11 +9,4 @@ sensors.touchSensor1.onEvent(TouchSensorEvent.Pressed, function () { sensors.touchSensor1.onEvent(TouchSensorEvent.Released, function () { brick.showImage(images.expressionsSick) }) -loops.forever(function () { - if (sensors.touchSensor1.isTouched()) { - brick.setStatusLight(LightsPattern.Green) - } else { - brick.setStatusLight(LightsPattern.Orange) - } -}) ``` \ No newline at end of file diff --git a/docs/reference.md b/docs/reference.md index ac34cc75..70f479f4 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -1,3 +1,7 @@ # Reference -TODO \ No newline at end of file + + +## See Also + +[touch sensor](/reference/sensors/touch-sensor) \ No newline at end of file diff --git a/libs/touch-sensor/docs/reference/sensors/touch-sensor.md b/libs/touch-sensor/docs/reference/sensors/touch-sensor.md new file mode 100644 index 00000000..7de9e8bc --- /dev/null +++ b/libs/touch-sensor/docs/reference/sensors/touch-sensor.md @@ -0,0 +1,15 @@ +# Touch Sensor + +```cards +sensors.touchSensor1.onEvent(TouchSensorEvent.Pressed, function () { + brick.showImage(images.expressionsBigSmile) +}) +sensors.touchSensor1.isPressed(); +sensors.touchSensor1.wasPressed(); +``` + +## See Also + +[on Event](/reference/sensors/touch-sensor/on-event), +[is pressed](reference/sensors/touch-sensor/is-pressed), +[was pressed](reference/sensors/touch-sensor/was-pressed) \ No newline at end of file diff --git a/libs/touch-sensor/docs/reference/sensors/touch-sensor/is-pressed.md b/libs/touch-sensor/docs/reference/sensors/touch-sensor/is-pressed.md new file mode 100644 index 00000000..7a1d9d21 --- /dev/null +++ b/libs/touch-sensor/docs/reference/sensors/touch-sensor/is-pressed.md @@ -0,0 +1,11 @@ +# is Pressed + +```blocks +loops.forever(function () { + if (sensors.touchSensor1.isPressed()) { + brick.setStatusLight(LightsPattern.Green) + } else { + brick.setStatusLight(LightsPattern.Orange) + } +}) +``` \ No newline at end of file diff --git a/libs/touch-sensor/docs/reference/sensors/touch-sensor/on-event.md b/libs/touch-sensor/docs/reference/sensors/touch-sensor/on-event.md new file mode 100644 index 00000000..2dedf566 --- /dev/null +++ b/libs/touch-sensor/docs/reference/sensors/touch-sensor/on-event.md @@ -0,0 +1,16 @@ +# On Event + +```sig +sensors.touchSensor1.onEvent(TouchSensorEvent.Released, function () { }) +``` + +# Parameters + +## Examples + + +```blocks +sensors.touchSensor1.onEvent(TouchSensorEvent.Released, function () { + brick.showImage(images.expressionsSick) +}) +``` diff --git a/libs/touch-sensor/docs/reference/sensors/touch-sensor/was-pressed.md b/libs/touch-sensor/docs/reference/sensors/touch-sensor/was-pressed.md new file mode 100644 index 00000000..70b94772 --- /dev/null +++ b/libs/touch-sensor/docs/reference/sensors/touch-sensor/was-pressed.md @@ -0,0 +1,11 @@ +# was Pressed + +```blocks +loops.forever(function () { + if (sensors.touchSensor1.wasPressed()) { + brick.setStatusLight(LightsPattern.Green) + } else { + brick.setStatusLight(LightsPattern.Orange) + } +}) +``` \ No newline at end of file