查看“MCookie-Motor”的源代码
←
MCookie-Motor
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{Language|mCookie-Motor}} {| style="width: 800px;" |- | [[File:motor-motor-rect.jpg|400px|thumb|right|mCookie-Motor]] mCookie-Motor is a DC motor controller with PWM(Pulse Width Modulation). The speed of the motor can be controlled through PWM and mCookie-Motor has to be powered with BM module. ==Features== *Current & speed limited by internal PWM *Synchronous rectification can reduce power consumption; *DC motor braking mode; *Capable of controlling two DC motors; ==Specification== *External power supply: BM module *Pin Description {|class="wikitable" ! rowspan="1" |mCookie pin||Motor chip pin||Function |- | D6|| 1A||Control 1A high level and rotate clockwise |- | D8|| 1B||Control 1B high level and rotate counter clockwise |- | D5|| 2A||Control 2A high level and rotate clockwise |- | D7|| 2B||Control 2A high level and rotate counter clockwise |- | VMOT||BM module||Power supply |- | GND||GND||Ground |} '''Note: The pins including 5, 6, 7 and 8 cannot be occupied by other sensors while using the Motor or it may cause problems. [[File:motor-Pinout-1Big.jpg|800px|thumb|center]] ==Document== ==Development== ===DC Motor Wire Connection=== *Connect one DC motor to (OUT1A, OUT1B) and the other to (OUT2A, OUT2B); *DC motor pin control: <source lang="cpp"> //(D6, D8) controls motor (1A, 1B) #define OUT1A 6 #define OUT1B 8 //(D5, D7) controls motor (2A, 2B) #define OUT2A 5 #define OUT2B 7 </source> ==PWM Rate Control== ==Project== *Connection and disconnection control {|class="wikitable" ! rowspan="1" |6||8||5||7||1A||1B||2A||2B||Function |- |Low||Low||Low||Low||Off||Off||Off||Off||Close (Stop habitually) |- |High||Low||High||Low||High||Low||High||Low||Rotate clockwise |- |Low||High||Low||High||Low||High||Low||High||Rotate counter clockwise |- |High||High||High||High||Low||Low||Low||Low||Halt |} <source lang="cpp"> #define OUT1A 6 #define OUT1B 8 #define OUT2A 5 #define OUT2B 7 void setup() { pinMode(OUT1A, OUTPUT); pinMode(OUT1B, OUTPUT); pinMode(OUT2A, OUTPUT); pinMode(OUT2B, OUTPUT); } void loop() { head(); delay(2000); back(); delay(1000); stop(); delay(500); } void head() { digitalWrite(OUT1A, HIGH); digitalWrite(OUT1B, LOW); digitalWrite(OUT2A, HIGH); digitalWrite(OUT2B, LOW); } void back() { digitalWrite(OUT1A, LOW); digitalWrite(OUT1B, HIGH); digitalWrite(OUT2A, LOW); digitalWrite(OUT2B, HIGH); } void stop() { digitalWrite(OUT1A, LOW); digitalWrite(OUT1B, LOW); digitalWrite(OUT2A, LOW); digitalWrite(OUT2B, LOW); } </source> *PWM rate control <source lang="cpp"> //(D6, D8) controls motor (1A, 1B) #define OUT1A 6 #define OUT1B 8 //(D5, D7) controls motor (2A, 2B) #define OUT2A 5 #define OUT2B 7 void setup() { pinMode(OUT1A, OUTPUT); pinMode(OUT1B, OUTPUT); pinMode(OUT2A, OUTPUT); pinMode(OUT2B, OUTPUT); } void loop() { for (int fadeValue = 0; fadeValue <= 255; fadeValue += 5) //Loop statement. Along with PWM rate increases, you can change brightness level by controlling fadeValue. { analogWrite(OUT1A, fadeValue); //Write rate level into the motor digitalWrite(OUT1B, LOW); analogWrite(OUT2A, fadeValue); digitalWrite(OUT2B, LOW); delay(100); //Delay time of rate. (The unit is ms) } for (int fadeValue = 255; fadeValue >= 0; fadeValue -= 5) // Loop statement. Along with PWM rate decreases, you can change brightness level by controlling fadeValue. { digitalWrite(OUT1A, LOW); analogWrite(OUT1B, fadeValue); // Write rate level into the motor digitalWrite(OUT2A, LOW); analogWrite(OUT2B, fadeValue); delay(100); // Delay time of rate. (The unit is ms) } delay(1000); } </source> '''Other Projects:''' ==Purchase== ==History== ==Pictures== [[File:mCookie-Motor-t1.jpg|thumb|600px|center]] [[File:mCookie-Motor-b1.jpg|thumb|600px|center]] ==Video== |}
该页面使用的模板:
模板:Language
(
查看源代码
)
模板:Nmbox
(
查看源代码
)
返回至
MCookie-Motor
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
Welcome
首页
创客大赛
大赛详情
3D打印
安装月球车
图形化编程
操控月球车
升级月球车
编程工具下载
软件下载
Arduino
Processing
Mixly
Scratch
模块套件
Microduino 102
mCookie 102
mCookie 202
mCookie 302
IBC
其他
应用套件
四轴飞行器
平衡车
小车CUBE
音乐播放器
刷卡音乐播放器
wifi气象站
彩虹音乐触摸灯
分贝检测仪
迎门汇报
LED点阵时钟
LED点阵屏幕
硬件
mCookie
Sensor
Microduino
MicroWrt
MicroNux
MicroRobot-Core
MicroRobot-CoreESP
ideaBoard
ideaBox
MicroMV
MicroAI
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息