diff --git a/docs/maker.md b/docs/maker.md index d96999cd..8ae53cb9 100644 --- a/docs/maker.md +++ b/docs/maker.md @@ -21,6 +21,20 @@ These six activities require the LEGO® MINDSTORMS® Education EV3 Core Set (455 "url":"/maker/sound-of-color", "cardType": "example", "imageUrl": "/static/maker/sound-of-color.png" +}, +{ + "name": "Security Gadget", + "description": "Raise the alarm when your brick is lifted!", + "url":"/maker/security-gadget", + "cardType": "example", + "imageUrl": "/static/maker/security-gadget.png" +}, +{ + "name": "Intruder Detector", + "description": "Raise the alarm when an intruder sneaks in", + "url":"/maker/intruder-detector", + "cardType": "example", + "imageUrl": "/static/maker/intruder-detector.png" } ] ``` diff --git a/docs/maker/intruder-detector.md b/docs/maker/intruder-detector.md new file mode 100644 index 00000000..7e4bed07 --- /dev/null +++ b/docs/maker/intruder-detector.md @@ -0,0 +1,11 @@ +# Intruder Detector + +This program will activate an alarm when an object moves in front of the Ultrasonic Sensor. + +TODO support for event when value changes + +```blocks +input.ultrasonic4.onObjectNear(function () { + music.playSoundUntilDone(music.sounds(Sounds.PowerUp)) +}) +``` \ No newline at end of file diff --git a/docs/maker/security-gadget.md b/docs/maker/security-gadget.md new file mode 100644 index 00000000..c926fc6a --- /dev/null +++ b/docs/maker/security-gadget.md @@ -0,0 +1,9 @@ +# Security Gadget + +This program will activate an alarm when an object is lifted from the Touch Sensor. + +```blocks +input.touchSensor1.onEvent(TouchSensorEvent.Released, function () { + music.playSoundUntilDone(music.sounds(Sounds.PowerUp)) +}) +``` \ No newline at end of file diff --git a/docs/static/maker/intruder-detector.png b/docs/static/maker/intruder-detector.png new file mode 100644 index 00000000..924dbe59 Binary files /dev/null and b/docs/static/maker/intruder-detector.png differ diff --git a/docs/static/maker/security-gadget.png b/docs/static/maker/security-gadget.png new file mode 100644 index 00000000..c7298d77 Binary files /dev/null and b/docs/static/maker/security-gadget.png differ diff --git a/libs/core/ultrasonic.ts b/libs/core/ultrasonic.ts index 5674ad98..b14894ee 100644 --- a/libs/core/ultrasonic.ts +++ b/libs/core/ultrasonic.ts @@ -43,7 +43,7 @@ namespace input { //% blockNamespace=input //% weight=100 blockGap=8 //% group="Ultrasonic Sensor" - onObjectNear(distance: number, handler: () => void) { + onObjectNear(handler: () => void) { control.onEvent(this._id, PromixityEvent.ObjectNear, handler); if (this.distance() == PromixityEvent.ObjectNear) control.runInBackground(handler);