标题: 谁能告诉我怎么通过这段程序来调电机速度 [打印本页]
作者: h1170460918 时间: 2016-12-16 00:58
标题: 谁能告诉我怎么通过这段程序来调电机速度
/* 电机控制函数 index-电机号(1,2); speed-电机速度(-100—100) */
void motor(uchar index, int speed)
{
if(speed>=-100 && speed<=100)
{
if(index==1) /* 电机1的处理 */
{
m1=abs(speed); /* 取速度的绝对值 */
if(speed>0) /* 速度值为正则正转 */
{
s1=0;
欢迎光临 (http://www.51hei.com/bbs/) |
Powered by Discuz! X3.1 |