Arduino 电机转动程序.docx

上传人:牧羊曲112 文档编号:3152891 上传时间:2023-03-11 格式:DOCX 页数:2 大小:36.37KB
返回 下载 相关 举报
Arduino 电机转动程序.docx_第1页
第1页 / 共2页
Arduino 电机转动程序.docx_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

《Arduino 电机转动程序.docx》由会员分享,可在线阅读,更多相关《Arduino 电机转动程序.docx(2页珍藏版)》请在三一办公上搜索。

1、Arduino 电机转动程序控制电机转动的Ardino程序 电子积木Ardino程序。 自己编了个,求指正 可以实现前后转。 mw_shl_code=c,true #define motor1I1 8 #define motor1I2 7 #define motor1pwm 10 #define motor2I3 4 #define motor2I4 5 #define motor2pwm 11 void setup pinMode(motor1I1,OUTPUT);/定义该接口为输出接口 pinMode(motor1I2,OUTPUT); pinMode(motor1pwm,OUTPUT);

2、 pinMode(motor2I3,OUTPUT);/定义该接口为输出接口 pinMode(motor2I4,OUTPUT); pinMode(motor2pwm,OUTPUT); void Goahead (int _speed) digitalWrite(motor1I1,HIGH);/使直流电机逆时针转 digitalWrite(motor1I2,LOW); analogWrite(motor1pwm,_speed); digitalWrite(motor2I3,LOW);/使直流电机顺时针转 digitalWrite(motor2I4,HIGH); analogWrite(motor2

3、pwm,_speed); void Back (int _speed) digitalWrite(motor1I2,HIGH);/使直流电机逆时针转 digitalWrite(motor1I1,LOW); analogWrite(motor1pwm,_speed); digitalWrite(motor2I4,LOW);/使直流电机顺时针转 digitalWrite(motor2I3,HIGH); analogWrite(motor2pwm,_speed); void loop Goahead(180); delay(5000); Back(180); delay(5000); /mw_shl_code

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号