Merge pull request #66 from Microsoft/gyroproject

moving gyro into separate project
This commit is contained in:
Peli de Halleux 2017-11-30 10:47:13 -08:00 committed by GitHub
commit 83e4898eab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 14 deletions

View File

@ -70,8 +70,6 @@
"screen.clear": "Clear screen and reset font to normal.", "screen.clear": "Clear screen and reset font to normal.",
"screen.imageOf": "Makes an image bound to a buffer.", "screen.imageOf": "Makes an image bound to a buffer.",
"screen.unpackPNG": "Decompresses a 1-bit gray scale PNG image to image format.", "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": "Reading and writing data over a serial connection.",
"serial.writeDmesg": "Send DMESG debug buffer over serial." "serial.writeDmesg": "Send DMESG debug buffer over serial."
} }

View File

@ -55,12 +55,6 @@
"motors|block": "motors", "motors|block": "motors",
"output|block": "output", "output|block": "output",
"screen|block": "screen", "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", "serial|block": "serial",
"{id:category}Brick": "Brick", "{id:category}Brick": "Brick",
"{id:category}Control": "Control", "{id:category}Control": "Control",
@ -70,10 +64,8 @@
"{id:category}Motors": "Motors", "{id:category}Motors": "Motors",
"{id:category}Output": "Output", "{id:category}Output": "Output",
"{id:category}Screen": "Screen", "{id:category}Screen": "Screen",
"{id:category}Sensors": "Sensors",
"{id:category}Serial": "Serial", "{id:category}Serial": "Serial",
"{id:group}Buttons": "Buttons", "{id:group}Buttons": "Buttons",
"{id:group}Gyro Sensor": "Gyro Sensor",
"{id:group}Light": "Light", "{id:group}Light": "Light",
"{id:group}Motors": "Motors", "{id:group}Motors": "Motors",
"{id:group}Screen": "Screen" "{id:group}Screen": "Screen"

View File

@ -18,7 +18,6 @@
"output.ts", "output.ts",
"core.ts", "core.ts",
"input.ts", "input.ts",
"gyro.ts",
"shims.d.ts", "shims.d.ts",
"enums.d.ts", "enums.d.ts",
"dal.d.ts", "dal.d.ts",

View File

@ -12,7 +12,8 @@
"color-sensor": "file:../color-sensor", "color-sensor": "file:../color-sensor",
"touch-sensor": "file:../touch-sensor", "touch-sensor": "file:../touch-sensor",
"ultrasonic-sensor": "file:../ultrasonic-sensor", "ultrasonic-sensor": "file:../ultrasonic-sensor",
"infrared-sensor": "file:../infrared-sensor" "infrared-sensor": "file:../infrared-sensor",
"gyro-sensor": "file:../gyro-sensor"
}, },
"public": true "public": true
} }

View File

@ -0,0 +1,3 @@
# Gyro Sensor
The library to interact with the Gyro Sensor.

View File

@ -30,7 +30,7 @@ namespace sensors {
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=65 blockGap=8 //% weight=65 blockGap=8
//% group="Gyro Sensor" //% group="Gyro Sensor"
angle() { angle(): number {
this.setMode(GyroSensorMode.Angle) this.setMode(GyroSensorMode.Angle)
return this.getNumber(NumberFormat.Int16LE, 0) return this.getNumber(NumberFormat.Int16LE, 0)
} }
@ -46,7 +46,7 @@ namespace sensors {
//% blockNamespace=sensors //% blockNamespace=sensors
//% weight=65 blockGap=8 //% weight=65 blockGap=8
//% group="Gyro Sensor" //% group="Gyro Sensor"
rate() { rate(): number {
this.setMode(GyroSensorMode.Rate) this.setMode(GyroSensorMode.Rate)
return this.getNumber(NumberFormat.Int16LE, 0) return this.getNumber(NumberFormat.Int16LE, 0)
} }

15
libs/gyro-sensor/pxt.json Normal file
View File

@ -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"
}
}

0
libs/gyro-sensor/test.ts Normal file
View File

View File

@ -14,6 +14,7 @@
"libs/touch-sensor", "libs/touch-sensor",
"libs/ultrasonic-sensor", "libs/ultrasonic-sensor",
"libs/infrared-sensor", "libs/infrared-sensor",
"libs/gyro-sensor",
"libs/ev3" "libs/ev3"
], ],
"simulator": { "simulator": {