查看“Servo Control”的源代码
←
Servo Control
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{| style="width: 800px;" |- | ==Objective== The course will show you how to control the turning of a steering engine by using Processing. ==Equipment== *'''[[Microduino-Core]]''' *'''[[Microduino-FT232R]]''' *Other Hardware Equipment **A USB cable **A steering engine ==Schematic== [[File:processingServoControlSchematics.jpg|600px|center|thumb]] ==Program== Referring to processingServoControl ==Debugging== Step 1: Build the hardware environment according to the schematic, as follows: [[File:processingServoControlConnectionDiagram.jpg|600px|center|thumb]] Step 2:Here the code needed: The code of the two ends (Processing and Microduino) Microduino: Using firmata StandardFirmata’s program since it achieves the method of how to control a steering engine Processing: //Define serial communication in “Setup” and set “pinMode” arduino = new Arduino(this, Arduino.list()[0], 57600); //your offset may vary arduino.pinMode(9, 5); //Read the value of the mouse on the x-coordinate to set the angle of the steering engine void draw() { // read mouseX coordinate int newPos = constrain(mouseX/2, 0, 180); // update bg & servo position if mouseX changed if (newPos != pos) { background(0); stroke(255); line(mouseX, 0, mouseX, 160); text (newPos, mouseX, 180); arduino.analogWrite(9, newPos); println (" newPos = " + newPos ); pos=newPos; //update servo position storage variable } } Step 3:Download the code and pass the compiling. Step 4:Move the mouse around to see how the steering changes after the system goes well. ==Result== In Processing, an indicator will be displayed. Along with the change of the mouse on the x-coordinate, the steering engine will also rotate: [[File:processingServoControlResult.jpg|600px|center|thumb]] ==Video== |}
返回至
Servo Control
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
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
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息