added 2 more activities
This commit is contained in:
parent
86212e2153
commit
6391620373
@ -21,6 +21,20 @@ These six activities require the LEGO® MINDSTORMS® Education EV3 Core Set (455
|
|||||||
"url":"/maker/sound-of-color",
|
"url":"/maker/sound-of-color",
|
||||||
"cardType": "example",
|
"cardType": "example",
|
||||||
"imageUrl": "/static/maker/sound-of-color.png"
|
"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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
11
docs/maker/intruder-detector.md
Normal file
11
docs/maker/intruder-detector.md
Normal file
@ -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))
|
||||||
|
})
|
||||||
|
```
|
9
docs/maker/security-gadget.md
Normal file
9
docs/maker/security-gadget.md
Normal file
@ -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))
|
||||||
|
})
|
||||||
|
```
|
BIN
docs/static/maker/intruder-detector.png
vendored
Normal file
BIN
docs/static/maker/intruder-detector.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
BIN
docs/static/maker/security-gadget.png
vendored
Normal file
BIN
docs/static/maker/security-gadget.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
@ -43,7 +43,7 @@ namespace input {
|
|||||||
//% blockNamespace=input
|
//% blockNamespace=input
|
||||||
//% weight=100 blockGap=8
|
//% weight=100 blockGap=8
|
||||||
//% group="Ultrasonic Sensor"
|
//% group="Ultrasonic Sensor"
|
||||||
onObjectNear(distance: number, handler: () => void) {
|
onObjectNear(handler: () => void) {
|
||||||
control.onEvent(this._id, PromixityEvent.ObjectNear, handler);
|
control.onEvent(this._id, PromixityEvent.ObjectNear, handler);
|
||||||
if (this.distance() == PromixityEvent.ObjectNear)
|
if (this.distance() == PromixityEvent.ObjectNear)
|
||||||
control.runInBackground(handler);
|
control.runInBackground(handler);
|
||||||
|
Loading…
Reference in New Issue
Block a user