From c814728354855b19af52a2ec47d039580f8bb917 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 5 Jan 2018 21:29:52 -0800 Subject: [PATCH] pdated ultrasonic default --- docs/coding/ignition-1.md | 11 +++++++++++ libs/ultrasonic-sensor/ultrasonic.ts | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 docs/coding/ignition-1.md diff --git a/docs/coding/ignition-1.md b/docs/coding/ignition-1.md new file mode 100644 index 00000000..81483010 --- /dev/null +++ b/docs/coding/ignition-1.md @@ -0,0 +1,11 @@ +# Ignition Activity 1 + +```blocks +sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () { + brick.showImage(images.eyesDizzy) +}) +sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectDetected, function () { + brick.showImage(images.eyesTiredMiddle) +}) +brick.showImage(images.eyesSleeping) +``` diff --git a/libs/ultrasonic-sensor/ultrasonic.ts b/libs/ultrasonic-sensor/ultrasonic.ts index 47df139f..17df8007 100644 --- a/libs/ultrasonic-sensor/ultrasonic.ts +++ b/libs/ultrasonic-sensor/ultrasonic.ts @@ -86,6 +86,9 @@ namespace sensors { return this._query(); } } + + //% fixedInstance whenUsed block="ultrasonic 4" jres=icons.port4 + export const ultrasonic4: UltraSonicSensor = new UltraSonicSensor(4) //% fixedInstance whenUsed block="ultrasonic 1" jres=icons.port1 export const ultrasonic1: UltraSonicSensor = new UltraSonicSensor(1) @@ -95,7 +98,4 @@ namespace sensors { //% fixedInstance whenUsed block="ultrasonic 3" jres=icons.port3 export const ultrasonic3: UltraSonicSensor = new UltraSonicSensor(3) - - //% fixedInstance whenUsed block="ultrasonic 4" jres=icons.port4 - export const ultrasonic4: UltraSonicSensor = new UltraSonicSensor(4) }