diff --git a/docs/coding.md b/docs/coding.md index 3e10772c..507c6b15 100644 --- a/docs/coding.md +++ b/docs/coding.md @@ -4,7 +4,7 @@ * [Download Curriculum Materials](https://education.lego.com/en-us/downloads/mindstorms-ev3) -## Activites +## Three Point Turn ```codecard [ @@ -23,7 +23,13 @@ "description": "Activity 3", "url":"/coding/three-point-turn-3", "cardType": "example" -}, { +}] +``` + +## Reversing the robot + +```codecard +[{ "name": "Reversing the robot", "description": "Activity 1", "url":"/coding/reversing-the-robot-1", @@ -38,6 +44,27 @@ "description": "Activity 3", "url":"/coding/reversing-the-robot-3", "cardType": "example" +}] +``` + +## Light the way + +```codecard +[{ + "name": "Light the way", + "description": "Activity 1", + "url":"/coding/light-the-way-1", + "cardType": "example" +}, { + "name": "Light the way", + "description": "Activity 2", + "url":"/coding/light-the-way-2", + "cardType": "example" +}, { + "name": "Light the way", + "description": "Activity 3", + "url":"/coding/light-the-way-3", + "cardType": "example" } ] ``` diff --git a/docs/coding/light-the-way-1.md b/docs/coding/light-the-way-1.md new file mode 100644 index 00000000..7341893c --- /dev/null +++ b/docs/coding/light-the-way-1.md @@ -0,0 +1,9 @@ +# Light the way Activity 1 + +```blocks +sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Dark, function () { + brick.showImage(images.objectsLightOn) + loops.pause(5000) + brick.clearScreen() +}) +``` \ No newline at end of file diff --git a/docs/coding/light-the-way-2.md b/docs/coding/light-the-way-2.md new file mode 100644 index 00000000..478c8e6d --- /dev/null +++ b/docs/coding/light-the-way-2.md @@ -0,0 +1,10 @@ +# Light the way Activity 2 + +```blocks +sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Bright, function () { + brick.clearScreen() +}) +sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Dark, function () { + brick.showImage(images.objectsLightOn) +}) +``` \ No newline at end of file diff --git a/docs/coding/light-the-way-3.md b/docs/coding/light-the-way-3.md new file mode 100644 index 00000000..a773e643 --- /dev/null +++ b/docs/coding/light-the-way-3.md @@ -0,0 +1,13 @@ +# Light the way Activity 3 + +```blocks +sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Bright, function () { + brick.clearScreen() +}) +sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Dark, function () { + brick.showImage(images.objectsLightOn) +}) +sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () { + brick.showImage(images.objectsLightOn); +}) +``` \ No newline at end of file diff --git a/libs/color-sensor/color.ts b/libs/color-sensor/color.ts index e3f89b22..ff06cf51 100644 --- a/libs/color-sensor/color.ts +++ b/libs/color-sensor/color.ts @@ -223,15 +223,15 @@ namespace sensors { } } + //% whenUsed block="color 3" weight=90 fixedInstance jres=icons.port3 + export const color3: ColorSensor = new ColorSensor(3) + //% whenUsed block="color 1" weight=95 fixedInstance jres=icons.port1 export const color1: ColorSensor = new ColorSensor(1) //% whenUsed block="color 2" weight=90 fixedInstance jres=icons.port2 export const color2: ColorSensor = new ColorSensor(2) - //% whenUsed block="color 3" weight=90 fixedInstance jres=icons.port3 - export const color3: ColorSensor = new ColorSensor(3) - //% whenUsed block="color 4" weight=90 fixedInstance jres=icons.port4 export const color4: ColorSensor = new ColorSensor(4) } diff --git a/libs/touch-sensor/_locales/touch-sensor-strings.json b/libs/touch-sensor/_locales/touch-sensor-strings.json index 63eefbd7..a94831c2 100644 --- a/libs/touch-sensor/_locales/touch-sensor-strings.json +++ b/libs/touch-sensor/_locales/touch-sensor-strings.json @@ -6,10 +6,10 @@ "sensors.TouchSensor.onEvent|block": "on %sensor|%event", "sensors.TouchSensor.pauseUntil|block": "pause until %sensor|%event", "sensors.TouchSensor.wasPressed|block": "%sensor|was pressed", - "sensors.touchSensor1|block": "touch 1", - "sensors.touchSensor2|block": "touch 2", - "sensors.touchSensor3|block": "touch 3", - "sensors.touchSensor4|block": "touch 4", + "sensors.touch1|block": "touch 1", + "sensors.touch2|block": "touch 2", + "sensors.touch3|block": "touch 3", + "sensors.touch4|block": "touch 4", "{id:category}Sensors": "Sensors", "{id:group}Touch Sensor": "Touch Sensor" } \ No newline at end of file diff --git a/libs/touch-sensor/test.ts b/libs/touch-sensor/test.ts index 082d6140..53a7ea2c 100644 --- a/libs/touch-sensor/test.ts +++ b/libs/touch-sensor/test.ts @@ -1,8 +1,8 @@ -sensors.touchSensor1.onEvent(TouchSensorEvent.Pressed, function () { +sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () { }) -sensors.touchSensor2.onEvent(TouchSensorEvent.Bumped, function () { +sensors.touch2.onEvent(TouchSensorEvent.Bumped, function () { }) -sensors.touchSensor3.onEvent(TouchSensorEvent.Released, function () { +sensors.touch3.onEvent(TouchSensorEvent.Released, function () { }) -sensors.touchSensor4.isPressed(); -sensors.touchSensor4.wasPressed(); +sensors.touch4.isPressed(); +sensors.touch4.wasPressed(); diff --git a/libs/touch-sensor/touch.ts b/libs/touch-sensor/touch.ts index 5edd7e10..2be12d78 100644 --- a/libs/touch-sensor/touch.ts +++ b/libs/touch-sensor/touch.ts @@ -102,11 +102,11 @@ namespace sensors { } //% whenUsed block="touch 1" weight=95 fixedInstance jres=icons.port1 - export const touchSensor1: TouchSensor = new TouchSensor(1) + export const touch1: TouchSensor = new TouchSensor(1) //% whenUsed block="touch 2" weight=95 fixedInstance jres=icons.port2 - export const touchSensor2: TouchSensor = new TouchSensor(2) + export const touch2: TouchSensor = new TouchSensor(2) //% whenUsed block="touch 3" weight=95 fixedInstance jres=icons.port3 - export const touchSensor3: TouchSensor = new TouchSensor(3) + export const touch3: TouchSensor = new TouchSensor(3) //% whenUsed block="touch 4" weight=95 fixedInstance jres=icons.port4 - export const touchSensor4: TouchSensor = new TouchSensor(4) + export const touch4: TouchSensor = new TouchSensor(4) } diff --git a/tests/touch.ts b/tests/touch.ts index b3a432d8..238865b2 100644 --- a/tests/touch.ts +++ b/tests/touch.ts @@ -3,5 +3,5 @@ tests.test("Touch sensor pressed", function () { brick.print("and click enter", 0, 60) brick.buttonEnter.pauseUntil(ButtonEvent.Click) brick.clearScreen() - tests.assert("Pressed", sensors.touchSensor1.isPressed()) + tests.assert("Pressed", sensors.touch1.isPressed()) }) \ No newline at end of file