output -> motors
This commit is contained in:
parent
bcb68d937d
commit
18fefa2a44
@ -56,24 +56,24 @@
|
|||||||
"input.remoteButtonCenter": "Remote beacon (center) button.",
|
"input.remoteButtonCenter": "Remote beacon (center) button.",
|
||||||
"input.remoteButtonTopLeft": "Remote top-left button.",
|
"input.remoteButtonTopLeft": "Remote top-left button.",
|
||||||
"input.remoteButtonTopRight": "Remote top-right button.",
|
"input.remoteButtonTopRight": "Remote top-right button.",
|
||||||
"output.Motor.clearCount": "Clears the motor count",
|
"motors.Motor.clearCount": "Clears the motor count",
|
||||||
"output.Motor.count": "Gets motor step count.",
|
"motors.Motor.count": "Gets motor step count.",
|
||||||
"output.Motor.on": "Power on or off the motor.",
|
"motors.Motor.on": "Power on or off the motor.",
|
||||||
"output.Motor.reset": "Resets the motor.",
|
"motors.Motor.reset": "Resets the motor.",
|
||||||
"output.Motor.setBrake": "Sets the automatic brake on or off when the motor is off",
|
"motors.Motor.setBrake": "Sets the automatic brake on or off when the motor is off",
|
||||||
"output.Motor.setBrake|param|brake": "a value indicating if the motor should break when off",
|
"motors.Motor.setBrake|param|brake": "a value indicating if the motor should break when off",
|
||||||
"output.Motor.setPower": "Sets the motor power level from ``-100`` to ``100``.",
|
"motors.Motor.setPower": "Sets the motor power level from ``-100`` to ``100``.",
|
||||||
"output.Motor.setPower|param|power": "the desired speed to use. eg: 50",
|
"motors.Motor.setPower|param|power": "the desired speed to use. eg: 50",
|
||||||
"output.Motor.setReversed": "Reverses the motor polarity",
|
"motors.Motor.setReversed": "Reverses the motor polarity",
|
||||||
"output.Motor.speed": "Gets motor actual speed.",
|
"motors.Motor.speed": "Gets motor actual speed.",
|
||||||
"output.Motor.tachoCount": "Gets motor tacho count.",
|
"motors.Motor.tachoCount": "Gets motor tacho count.",
|
||||||
|
"motors.pattern": "Pattern block.",
|
||||||
|
"motors.pattern|param|pattern": "the lights pattern to use. eg: LightsPattern.Green",
|
||||||
|
"motors.setStatusLight": "Set lights.",
|
||||||
|
"motors.setStatusLight|param|pattern": "the lights pattern to use.",
|
||||||
|
"motors.stopAllMotors": "Stops all motors",
|
||||||
"output.createBuffer": "Create a new zero-initialized buffer.",
|
"output.createBuffer": "Create a new zero-initialized buffer.",
|
||||||
"output.createBuffer|param|size": "number of bytes in the buffer",
|
"output.createBuffer|param|size": "number of bytes in the buffer",
|
||||||
"output.pattern": "Pattern block.",
|
|
||||||
"output.pattern|param|pattern": "the lights pattern to use. eg: LightsPattern.Green",
|
|
||||||
"output.setStatusLight": "Set lights.",
|
|
||||||
"output.setStatusLight|param|pattern": "the lights pattern to use.",
|
|
||||||
"output.stopAllMotors": "Stops all motors",
|
|
||||||
"screen.clear": "Clear screen and reset font to normal.",
|
"screen.clear": "Clear screen and reset font to normal.",
|
||||||
"screen.doubleIcon": "Double size of an icon.",
|
"screen.doubleIcon": "Double size of an icon.",
|
||||||
"screen.drawIcon": "Draw an icon on the screen.",
|
"screen.drawIcon": "Draw an icon on the screen.",
|
||||||
|
@ -82,32 +82,35 @@
|
|||||||
"input.ultrasonic3|block": "ultrasonic sensor 3",
|
"input.ultrasonic3|block": "ultrasonic sensor 3",
|
||||||
"input.ultrasonic4|block": "ultrasonic sensor 4",
|
"input.ultrasonic4|block": "ultrasonic sensor 4",
|
||||||
"input|block": "input",
|
"input|block": "input",
|
||||||
"output.Motor.count|block": "%motor|count",
|
"motors.Motor.count|block": "%motor|count",
|
||||||
"output.Motor.on|block": "%motor|%onOrOff",
|
"motors.Motor.on|block": "%motor|%onOrOff",
|
||||||
"output.Motor.setBrake|block": "%motor|set brake %brake",
|
"motors.Motor.setBrake|block": "%motor|set brake %brake",
|
||||||
"output.Motor.setPower|block": "%motor|set power to %speed",
|
"motors.Motor.setPower|block": "%motor|set power to %speed",
|
||||||
"output.Motor.setReversed|block": "%motor|set reversed %reversed",
|
"motors.Motor.setReversed|block": "%motor|set reversed %reversed",
|
||||||
"output.Motor.speed|block": "%motor|speed",
|
"motors.Motor.speed|block": "%motor|speed",
|
||||||
"output.Motor.tachoCount|block": "%motor|tacho count",
|
"motors.Motor.tachoCount|block": "%motor|tacho count",
|
||||||
"output.largeMotorA|block": "large motor A",
|
"motors.largeMotorA|block": "large motor A",
|
||||||
"output.largeMotorB|block": "large motor B",
|
"motors.largeMotorB|block": "large motor B",
|
||||||
"output.largeMotorC|block": "large motor C",
|
"motors.largeMotorC|block": "large motor C",
|
||||||
"output.largeMotorD|block": "large motor D",
|
"motors.largeMotorD|block": "large motor D",
|
||||||
"output.mediumMotorA|block": "medium motor A",
|
"motors.mediumMotorA|block": "medium motor A",
|
||||||
"output.mediumMotorB|block": "medium motor B",
|
"motors.mediumMotorB|block": "medium motor B",
|
||||||
"output.mediumMotorC|block": "medium motor C",
|
"motors.mediumMotorC|block": "medium motor C",
|
||||||
"output.mediumMotorD|block": "medium motor D",
|
"motors.mediumMotorD|block": "medium motor D",
|
||||||
"output.pattern|block": "%pattern",
|
"motors.pattern|block": "%pattern",
|
||||||
"output.setStatusLight|block": "set status light %pattern=led_pattern",
|
"motors.setStatusLight|block": "set status light %pattern=led_pattern",
|
||||||
"output.stopAllMotors|block": "stop all motors",
|
"motors.stopAllMotors|block": "stop all motors",
|
||||||
|
"motors|block": "motors",
|
||||||
"output|block": "output",
|
"output|block": "output",
|
||||||
"screen.print|block": "print %text| at x: %x| y: %y",
|
"screen.print|block": "print %text| at x: %x| y: %y",
|
||||||
"screen.setPixel|block": "set pixel %on| at x: %x| y: %y",
|
"screen.setPixel|block": "set pixel %on| at x: %x| y: %y",
|
||||||
"screen|block": "screen",
|
"screen|block": "screen",
|
||||||
"serial|block": "serial",
|
"serial|block": "serial",
|
||||||
|
"{id:category}Brick": "Brick",
|
||||||
"{id:category}Control": "Control",
|
"{id:category}Control": "Control",
|
||||||
"{id:category}Input": "Input",
|
"{id:category}Input": "Input",
|
||||||
"{id:category}MMap": "MMap",
|
"{id:category}MMap": "MMap",
|
||||||
|
"{id:category}Motors": "Motors",
|
||||||
"{id:category}Output": "Output",
|
"{id:category}Output": "Output",
|
||||||
"{id:category}Screen": "Screen",
|
"{id:category}Screen": "Screen",
|
||||||
"{id:category}Serial": "Serial",
|
"{id:category}Serial": "Serial",
|
||||||
|
@ -226,7 +226,7 @@ namespace control {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace output {
|
namespace motors {
|
||||||
let currPattern: LightsPattern
|
let currPattern: LightsPattern
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,7 @@ enum OutputType {
|
|||||||
MiniTacho = 8,
|
MiniTacho = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace output {
|
namespace motors {
|
||||||
let pwmMM: MMap
|
let pwmMM: MMap
|
||||||
let motorMM: MMap
|
let motorMM: MMap
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ namespace output {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mkCmd(out: Output, cmd: number, addSize: number) {
|
function mkCmd(out: Output, cmd: number, addSize: number) {
|
||||||
const b = createBuffer(2 + addSize)
|
const b = output.createBuffer(2 + addSize)
|
||||||
b.setNumber(NumberFormat.UInt8LE, 0, cmd)
|
b.setNumber(NumberFormat.UInt8LE, 0, cmd)
|
||||||
b.setNumber(NumberFormat.UInt8LE, 1, out)
|
b.setNumber(NumberFormat.UInt8LE, 1, out)
|
||||||
return b
|
return b
|
||||||
|
@ -85,7 +85,7 @@ namespace screen {
|
|||||||
* @param y the starting position's x coordinate, eg: 0
|
* @param y the starting position's x coordinate, eg: 0
|
||||||
*/
|
*/
|
||||||
//% blockId=screen_setpixel block="set pixel %on| at x: %x| y: %y"
|
//% blockId=screen_setpixel block="set pixel %on| at x: %x| y: %y"
|
||||||
//% weight=98 group="Brick" blockNamespace=output
|
//% weight=98 group="Brick" blockNamespace=brick
|
||||||
//% x.min=0 x.max=178 y.min=0 y.max=128 on.fieldEditor=toggleonoff
|
//% x.min=0 x.max=178 y.min=0 y.max=128 on.fieldEditor=toggleonoff
|
||||||
export function setPixel(on: boolean, x: number, y: number) {
|
export function setPixel(on: boolean, x: number, y: number) {
|
||||||
x |= 0
|
x |= 0
|
||||||
@ -101,7 +101,7 @@ namespace screen {
|
|||||||
* @param y the starting position's x coordinate, eg: 0
|
* @param y the starting position's x coordinate, eg: 0
|
||||||
*/
|
*/
|
||||||
//% blockId=screen_print block="print %text| at x: %x| y: %y"
|
//% blockId=screen_print block="print %text| at x: %x| y: %y"
|
||||||
//% weight=99 group="Brick" blockNamespace=output inlineInputMode="inline"
|
//% weight=99 group="Brick" blockNamespace=brick inlineInputMode="inline"
|
||||||
//% x.min=0 x.max=178 y.min=0 y.max=128
|
//% x.min=0 x.max=178 y.min=0 y.max=128
|
||||||
export function print(text: string, x: number, y: number, mode = Draw.Normal) {
|
export function print(text: string, x: number, y: number, mode = Draw.Normal) {
|
||||||
x |= 0
|
x |= 0
|
||||||
|
@ -2,7 +2,7 @@ screen.clear()
|
|||||||
screen.print("PXT!", 10, 30, Draw.Quad)
|
screen.print("PXT!", 10, 30, Draw.Quad)
|
||||||
|
|
||||||
screen.drawRect(40, 40, 20, 10, Draw.Fill)
|
screen.drawRect(40, 40, 20, 10, Draw.Fill)
|
||||||
output.setStatusLight(LightsPattern.Orange)
|
motors.setStatusLight(LightsPattern.Orange)
|
||||||
|
|
||||||
screen.drawIcon(100, 50, screen.doubleIcon(screen.heart), Draw.Double | Draw.Transparent)
|
screen.drawIcon(100, 50, screen.doubleIcon(screen.heart), Draw.Double | Draw.Transparent)
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ input.buttonEnter.onEvent(ButtonEvent.Click, () => {
|
|||||||
|
|
||||||
input.buttonLeft.onEvent(ButtonEvent.Click, () => {
|
input.buttonLeft.onEvent(ButtonEvent.Click, () => {
|
||||||
screen.drawRect(10, 70, 20, 10, Draw.Fill)
|
screen.drawRect(10, 70, 20, 10, Draw.Fill)
|
||||||
output.setStatusLight(LightsPattern.Red)
|
motors.setStatusLight(LightsPattern.Red)
|
||||||
screen.setFont(screen.microbitFont())
|
screen.setFont(screen.microbitFont())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ namespace input {
|
|||||||
|
|
||||||
//% color="#8AC044" weight=90 icon="\uf185"
|
//% color="#8AC044" weight=90 icon="\uf185"
|
||||||
//% groups='["Motors", "Brick"]'
|
//% groups='["Motors", "Brick"]'
|
||||||
namespace output {
|
namespace motors {
|
||||||
}
|
}
|
||||||
|
|
||||||
//% color="#DF5014" weight=80
|
//% color="#DF5014" weight=80
|
||||||
|
Loading…
Reference in New Issue
Block a user