Ai
1 Star 0 Fork 0

DFRobot/pxt-Math-Automatic

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
servo.ts 662 Bytes
一键复制 编辑 原始数据 按行查看 历史
知音少断弦有谁听t 提交于 2019-08-08 15:36 +08:00 . 1
//% weight=10
namespace keyboard {
export enum aServos {
//% blockId="S1" block="S1"
S1 = 0,
//% blockId="S2" block="S2"
S2 = 1
}
//% weight=10
//% blockId=servo_ServoRun block="Servo|%index|angle|%angle"
//% angle.min=0 angle.max=180
//% index.fieldEditor="gridpicker" index.fieldOptions.columns=2
export function ServoRun(index: aServos, angle: number): void {
let buf = pins.createBuffer(2);
if (index == 0) {
buf[0] = 0x14;
}
if (index == 1) {
buf[0] = 0x15;
}
buf[1] = angle;
pins.i2cWriteBuffer(0x10, buf);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dfrobot/pxt-Math-Automatic.git
git@gitee.com:dfrobot/pxt-Math-Automatic.git
dfrobot
pxt-Math-Automatic
pxt-Math-Automatic
master

搜索帮助