ImageVerifierCode 换一换
格式:DOCX , 页数:13 ,大小:16.39KB ,
资源ID:24112008      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/24112008.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(基于arduino的记时机器人.docx)为本站会员(b****2)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

基于arduino的记时机器人.docx

1、基于arduino的记时机器人/ units: mm; microseconds; radians/ origin: bottom left of drawing surface/ delete or mark the next line as comment when done with calibration /#define CALIBRATION/ When in calibration mode, adjust the following factor until the servos move exactly 90 degrees#define SERVOFAKTOR 620/ Z

2、ero-position of left and right servo/ When in calibration mode, adjust the NULL-values so that the servo arms are at all times parallel/ either to the X or Y axis#define SERVOLEFTNULL 1900#define SERVORIGHTNULL 984#define SERVOPINLIFT 2#define SERVOPINLEFT 3#define SERVOPINRIGHT 4/ lift positions of

3、 lifting servo#define LIFT0 980/1080 / on drawing surface#define LIFT1 825/925 / between numbers#define LIFT2 625/725 / going towards sweeper/ speed of liftimg arm, higher is slower#define LIFTSPEED 1500/ length of arms#define L1 35#define L2 55.1#define L3 13.2/ origin points of left and right serv

4、o #define O1X 22#define O1Y -25#define O2X 47#define O2Y -25#include / see http:/playground.arduino.cc/Code/time#include int servoLift = 1500;Servo servo1; / Servo servo2; / Servo servo3; / volatile double lastX = 75;volatile double lastY = 47.5;int last_min = 0;void setup() / Set current time only

5、the first to values, hh,mm are needed setTime(12,18,0,0,0,0); drawTo(75.2, 47); lift(0); servo1.attach(SERVOPINLIFT); / lifting servo servo2.attach(SERVOPINLEFT); / left servo servo3.attach(SERVOPINRIGHT); / right servo delay(1000); void loop() #ifdef CALIBRATION / Servohorns will have 90 between mo

6、vements, parallel to x and y axis drawTo(-3, 29.2); delay(500); drawTo(74.1, 28); delay(500);#else int i = 0; if (last_min != minute() if (!servo1.attached() servo1.attach(SERVOPINLIFT); if (!servo2.attached() servo2.attach(SERVOPINLEFT); if (!servo3.attached() servo3.attach(SERVOPINRIGHT); lift(0);

7、 hour(); while (i+1)*10 = hour() i+; number(3, 3, 111, 1); number(5, 25, i, 1); number(19, 25, (hour()-i*10), 1); number(28, 25, 11, 1); i=0; while (i+1)*10 = LIFT0) while (servoLift = LIFT0) servoLift-; servo1.writeMicroseconds(servoLift); delayMicroseconds(LIFTSPEED); else while (servoLift = LIFT1

8、) while (servoLift = LIFT1) servoLift-; servo1.writeMicroseconds(servoLift); delayMicroseconds(LIFTSPEED); else while (servoLift = LIFT2) while (servoLift = LIFT2) servoLift-; servo1.writeMicroseconds(servoLift); delayMicroseconds(LIFTSPEED); else while (servoLift ende);void bogenGZS(float bx, float

9、 by, float radius, int start, int ende, float sqee) float inkr = 0.05; float count = 0; do drawTo(sqee * radius * cos(start + count) + bx, radius * sin(start + count) + by); count += inkr; while (start + count) = ende);void drawTo(double pX, double pY) double dx, dy, c; int i; / dx dy of new point d

10、x = pX - lastX; dy = pY - lastY; /path lenght in mm, times 4 equals 4 steps per mm c = floor(4 * sqrt(dx * dx + dy * dy); if (c 1) c = 1; for (i = 0; i = c; i+) / draw line point by point set_XY(lastX + (i * dx / c), lastY + (i * dy / c); lastX = pX; lastY = pY;double return_angle(double a, double b

11、, double c) / cosine rule for angle between c and a return acos(a * a + c * c - b * b) / (2 * a * c);void set_XY(double Tx, double Ty) delay(1); double dx, dy, c, a1, a2, Hx, Hy; / calculate triangle between pen, servoLeft and arm joint / cartesian dx/dy dx = Tx - O1X; dy = Ty - O1Y; / polar lemgth

12、(c) and angle (a1) c = sqrt(dx * dx + dy * dy); / a1 = atan2(dy, dx); / a2 = return_angle(L1, L2, c); servo2.writeMicroseconds(floor(a2 + a1 - M_PI) * SERVOFAKTOR) + SERVOLEFTNULL); / calculate joinr arm point for triangle of the right servo arm a2 = return_angle(L2, L1, c); Hx = Tx + L3 * cos(a1 -

13、a2 + 0.621) + M_PI); /36,5 Hy = Ty + L3 * sin(a1 - a2 + 0.621) + M_PI); / calculate triangle between pen joint, servoRight and arm joint dx = Hx - O2X; dy = Hy - O2Y; c = sqrt(dx * dx + dy * dy); a1 = atan2(dy, dx); a2 = return_angle(L1, (L2 - L3), c); servo3.writeMicroseconds(floor(a1 - a2) * SERVOFAKTOR) + SERVORIGHTNULL);

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1