diff --git a/libs/core/_locales/core-jsdoc-strings.json b/libs/core/_locales/core-jsdoc-strings.json index e0872308..d59f4270 100644 --- a/libs/core/_locales/core-jsdoc-strings.json +++ b/libs/core/_locales/core-jsdoc-strings.json @@ -70,8 +70,6 @@ "screen.clear": "Clear screen and reset font to normal.", "screen.imageOf": "Makes an image bound to a buffer.", "screen.unpackPNG": "Decompresses a 1-bit gray scale PNG image to image format.", - "sensors.GyroSensor.angle": "Get the current angle from the gyroscope.", - "sensors.GyroSensor.rate": "Get the current rotation rate from the gyroscope.", "serial": "Reading and writing data over a serial connection.", "serial.writeDmesg": "Send DMESG debug buffer over serial." } \ No newline at end of file diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index 531eeb01..2f10e924 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -55,12 +55,6 @@ "motors|block": "motors", "output|block": "output", "screen|block": "screen", - "sensors.GyroSensor.angle|block": "`icons.gyroSensor` %sensor|angle", - "sensors.GyroSensor.rate|block": "`icons.gyroSensor` %sensor|rotation rate", - "sensors.gyro1|block": "1", - "sensors.gyro2|block": "2", - "sensors.gyro3|block": "3", - "sensors.gyro4|block": "4", "serial|block": "serial", "{id:category}Brick": "Brick", "{id:category}Control": "Control", @@ -70,10 +64,8 @@ "{id:category}Motors": "Motors", "{id:category}Output": "Output", "{id:category}Screen": "Screen", - "{id:category}Sensors": "Sensors", "{id:category}Serial": "Serial", "{id:group}Buttons": "Buttons", - "{id:group}Gyro Sensor": "Gyro Sensor", "{id:group}Light": "Light", "{id:group}Motors": "Motors", "{id:group}Screen": "Screen" diff --git a/libs/core/pxt.json b/libs/core/pxt.json index 203eb3b7..39c6f5e7 100644 --- a/libs/core/pxt.json +++ b/libs/core/pxt.json @@ -18,7 +18,6 @@ "output.ts", "core.ts", "input.ts", - "gyro.ts", "shims.d.ts", "enums.d.ts", "dal.d.ts", diff --git a/libs/ev3/pxt.json b/libs/ev3/pxt.json index 6d5ca312..a5c384c2 100644 --- a/libs/ev3/pxt.json +++ b/libs/ev3/pxt.json @@ -12,7 +12,8 @@ "color-sensor": "file:../color-sensor", "touch-sensor": "file:../touch-sensor", "ultrasonic-sensor": "file:../ultrasonic-sensor", - "infrared-sensor": "file:../infrared-sensor" + "infrared-sensor": "file:../infrared-sensor", + "gyro-sensor": "file:../gyro-sensor" }, "public": true } diff --git a/libs/gyro-sensor/README.md b/libs/gyro-sensor/README.md new file mode 100644 index 00000000..e378a0a1 --- /dev/null +++ b/libs/gyro-sensor/README.md @@ -0,0 +1,3 @@ +# Gyro Sensor + +The library to interact with the Gyro Sensor. \ No newline at end of file diff --git a/libs/core/gyro.ts b/libs/gyro-sensor/gyro.ts similarity index 97% rename from libs/core/gyro.ts rename to libs/gyro-sensor/gyro.ts index 2a394cc6..59ed387f 100644 --- a/libs/core/gyro.ts +++ b/libs/gyro-sensor/gyro.ts @@ -30,7 +30,7 @@ namespace sensors { //% blockNamespace=sensors //% weight=65 blockGap=8 //% group="Gyro Sensor" - angle() { + angle(): number { this.setMode(GyroSensorMode.Angle) return this.getNumber(NumberFormat.Int16LE, 0) } @@ -46,7 +46,7 @@ namespace sensors { //% blockNamespace=sensors //% weight=65 blockGap=8 //% group="Gyro Sensor" - rate() { + rate(): number { this.setMode(GyroSensorMode.Rate) return this.getNumber(NumberFormat.Int16LE, 0) } diff --git a/libs/gyro-sensor/pxt.json b/libs/gyro-sensor/pxt.json new file mode 100644 index 00000000..ccfefa2b --- /dev/null +++ b/libs/gyro-sensor/pxt.json @@ -0,0 +1,15 @@ +{ + "name": "gyro-sensor", + "description": "Gyro Sensor support", + "files": [ + "README.md", + "gyro.ts" + ], + "testFiles": [ + "test.ts" + ], + "public": true, + "dependencies": { + "core": "file:../core" + } +} \ No newline at end of file diff --git a/libs/gyro-sensor/test.ts b/libs/gyro-sensor/test.ts new file mode 100644 index 00000000..e69de29b diff --git a/pxtarget.json b/pxtarget.json index 1f16ae36..30dddfd8 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -14,6 +14,7 @@ "libs/touch-sensor", "libs/ultrasonic-sensor", "libs/infrared-sensor", + "libs/gyro-sensor", "libs/ev3" ], "simulator": {