diff --git a/_locales/zh/ovobot-jsdoc-strings.json b/_locales/zh/ovobot-jsdoc-strings.json index f4a5e02..858a021 100644 --- a/_locales/zh/ovobot-jsdoc-strings.json +++ b/_locales/zh/ovobot-jsdoc-strings.json @@ -10,6 +10,9 @@ "ovobot.rawMotor|param|duration": "旋转时间,eg:0 ", "ovobot.rawMotor|param|left": "左轮速度,left.min=-255 left.max=255 eg: 0", "ovobot.rawMotor|param|right": "右轮速度,right.min=-255 right.max=255 eg:0", + "ovobot.rawMotorWithPwm": "TODO: 独立设置左右轮速度函数。", + "ovobot.rawMotorWithPwm|param|left": "左轮速度,left.min=-255 left.max=255 eg: 0", + "ovobot.rawMotorWithPwm|param|right": "右轮速度,right.min=-255 right.max=255 eg:0", "ovobot.readDistance": "TODO: 获取超声波传感器与前方障碍物的距离函数。", "ovobot.readLightStrength": "TODO: 获取光电强度函数。", "ovobot.readLineSensorData": "TODO: 获取左右巡线传感器数据函数。", diff --git a/_locales/zh/ovobot-strings.json b/_locales/zh/ovobot-strings.json index 6fbd1fd..2a09636 100644 --- a/_locales/zh/ovobot-strings.json +++ b/_locales/zh/ovobot-strings.json @@ -15,6 +15,7 @@ "ovobot.initGyroSensor|block": "初始化陀螺仪", "ovobot.move|block": "移动|方向 %movedir|速度 %speed|时间 (ms) %duration", "ovobot.rawMotor|block": "驱动电机|左轮 %left|右轮 %right|时间 (ms) %duration", + "ovobot.rawMotorWithPwm|block": "驱动电机|左轮 %left|右轮 %right", "ovobot.readDistance|block": "超声波距离", "ovobot.readLightStrength|block": "光线强度", "ovobot.readLineSensorData|block": "检测黑线 %lineSensor", diff --git a/ovobot.ts b/ovobot.ts index 8597167..94fe252 100644 --- a/ovobot.ts +++ b/ovobot.ts @@ -619,6 +619,20 @@ namespace ovobot { moveMotorOut(0, 0); } + /** + * TODO: 独立设置左右轮速度函数。 + * @param left 左轮速度,left.min=-255 left.max=255 eg: 0 + * @param right 右轮速度,right.min=-255 right.max=255 eg:0 + */ + //% blockId=set_rawMotor_withpwm block="rawMotor |left %left|right %right" + //% weight=55 + export function rawMotorWithPwm(left: number, right: number) { + setupMotorPWM(); + left = constract(left, -255, 255); + right = constract(right, -255, 255); + moveMotorOut(left, right); + } + /** * TODO: 获取超声波传感器与前方障碍物的距离函数。 */ diff --git a/pxt.json b/pxt.json index 043e9a2..349d076 100644 --- a/pxt.json +++ b/pxt.json @@ -1,6 +1,6 @@ { "name": "ovobot", - "version": "0.0.5", + "version": "0.0.6", "dependencies": { "core": "*", "radio": "*"