fixing a bunch of snippets
This commit is contained in:
@ -2,10 +2,8 @@
|
||||
|
||||
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))
|
||||
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectNear, function () {
|
||||
music.playSoundEffectUntilDone(sounds.informationActivate)
|
||||
})
|
||||
```
|
@ -4,14 +4,12 @@ Use this program with the Programmable Brick and Large Motor.
|
||||
|
||||
```blocks
|
||||
loops.forever(function () {
|
||||
output.largeMotorA.setPower(30)
|
||||
output.largeMotorA.on(true)
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(100)
|
||||
output.largeMotorA.on(false)
|
||||
music.playSoundUntilDone(music.sounds(Sounds.PowerUp))
|
||||
output.largeMotorA.setPower(-30)
|
||||
output.largeMotorA.on(true)
|
||||
motors.largeA.stop()
|
||||
music.playSoundEffectUntilDone(sounds.animalsCatPurr)
|
||||
motors.largeA.setSpeed(-30)
|
||||
loops.pause(100)
|
||||
output.largeMotorA.on(false)
|
||||
motors.largeA.stop()
|
||||
})
|
||||
```
|
||||
|
@ -3,7 +3,7 @@
|
||||
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))
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Released, function () {
|
||||
music.playSoundEffectUntilDone(sounds.informationActivate);
|
||||
})
|
||||
```
|
@ -4,9 +4,9 @@ This example program combined with the small model will make a beat and rhythm o
|
||||
|
||||
```blocks
|
||||
loops.forever(function () {
|
||||
output.motorA.on(50)
|
||||
motors.largeA.setSpeed(50)
|
||||
loops.pause(200)
|
||||
output.motorA.on(100)
|
||||
motors.largeA.setSpeed(100)
|
||||
loops.pause(200)
|
||||
})
|
||||
```
|
@ -3,13 +3,13 @@
|
||||
This program will play different sounds when the wheel is rotated. The sound is determined by which color is placed in front of the color Sensor.
|
||||
|
||||
```blocks
|
||||
input.color3.onColorDetected(ColorSensorColor.Blue, function () {
|
||||
sensors.color3.onColorDetected(ColorSensorColor.Blue, function () {
|
||||
music.playTone(Note.G4, music.beat(BeatFraction.Half))
|
||||
})
|
||||
input.color3.onColorDetected(ColorSensorColor.Red, function () {
|
||||
sensors.color3.onColorDetected(ColorSensorColor.Red, function () {
|
||||
music.playTone(Note.C5, music.beat(BeatFraction.Half))
|
||||
})
|
||||
input.color3.onColorDetected(ColorSensorColor.Green, function () {
|
||||
sensors.color3.onColorDetected(ColorSensorColor.Green, function () {
|
||||
music.playTone(Note.D5, music.beat(BeatFraction.Half))
|
||||
})
|
||||
```
|
Reference in New Issue
Block a user