⇤ ← Revision 1 as of 2008-04-19 11:07:12
Size: 2331
Comment:
|
Size: 10
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= 直流电机 = void DCMotor(int motorNo, int mode) motorNo 电机的序号 mode 电机的运转方式,取值0、1、2 0正转 1停止 2反转 本软件平台中提供了对4个直流电机的控制。在实际使用中,常常使用直流电机驱动车轮的运转。假如在机器人中配置两个轮子,通过两个直流电机的运行控制就可以实现机器人的前进、后退和转弯等动作,如果左轮接电机1,右轮接电机2,则控制方式如下: 前进:DCMotor(1,0) DCMotor(2,0) 后退:DCMotor(1,2) DCMotor(2,2) 左转:DCMotor(1,0) DCMotor(2,1) 右转:DCMotor(1,0) DCMotor(2,1) = 伺服电机 = void servoMotor(int motorNo, int Degree) motorNo 电机的序号 Degree 转动的角度0~180 = 电机调速 = voidSpeed(int motorNo ,int pwm) motorNo 电机的序号 pwm 0~100 0=停止 100=满负荷运转 = 延时 = void Delay(int number) number 0~65535 单位=ms = LCD输出 = void LCDLine[1/2](char *SP, int flag, int parameter) *SP 需要显示的提示信息的字符串指针 flag 是否显示变量标志(0不显示变量,1显示变量) parameter 要显示变量的变量名 = 蜂鸣器 = void beep(times) times 蜂鸣器响的次数 = 红外传感器 = int infraredSensor(int channelNo) channelNo 通道号 返回值 所感应的环境的红外值 变量定义: DataDefine = "int v_hw" & Trim(.IconPara(0)) & ";" ExecSentence = "i v_hw " & Trim(.IconPara(0)) & "=infraredSensor(" & Trim(.IconPara(0)) & ");" = 灰度传感器 = int greySensor(int channelNo) channelNo 通道号 返回值 所感应的介质灰度值 变量定义: DataDefine = "int v_hd" & Trim(.IconPara(0)) & ";" ExecSentence = "v_hd" & Trim(.IconPara(0)) & "=greySensor(" & Trim(.IconPara(0)) & ");" = 超声波传感器 = int ultraSonic(int channelNo) channelNo 通道号 返回值 所感应的障碍物的距离 变量定义: DataDefine = "int v_cb" & Trim(.IconPara(0)) & ";" ExecSentence = "v_cb" & Trim(.IconPara(0)) & "=ultraSonic(" & Trim(.IconPara(0)) & ");" = 温度传感器 = unsigned bytetemperature(channelNo) channelNo 通道号 返回值 所感应的环境的温度。 |
#deleted |