Arduino Robot专为机器人设计

     想认识arduino是什么东东吗?

Arduino有轮子了!这是由Arduino官方开发出来的新产品,称为Arduino Robot,而顾名思义,这是一款专为机器人设计而定位的产品。

 

  来看看它的规格。Arduino Robot由两块圆型的电路板所组成,上层为控制板,拥有LCD面板、四个按钮、一个扬声器、一个数字罗盘和三颗LED;下层为马达驱动板,附上两个轮子、可配置四颗AA电池,以及五颗IR传感器及相应的LED。这两个板子上各有一颗与Leonardo板相同的Atmega32u4处理器(Atmel制造)。

有轮子的Arduino Robot来了

  有了这么一组功能齐备的开发工具包,Maker们将更容易打造出一些机器人原型。不过,对于要求更大设计弹性的玩家来说,可能还是会买个Uno或Leonardo,再配个马达控制扩充板,自行搭配马达、Servo、致动器来组合吧。不过,Arduino Robot还是切入机器人设计的极佳入门选择。

  如果你对这款新产品有兴趣,Arduino创办人Massimo Banzi亲自录制了五集视讯教程,一一探讨这款新式轮式开源硬件的各种特征。本系列教程在意大利罗马的创意嘉年华大会(Maker Faire)上推出,可透过 RS Components 的 YouTube 独家频道观看。主要媒介语为英语,且备有法语、德语、简体中文、繁体中文和日语字幕版本(目前繁体中文版有三部上线了)。

  全套节目共分五集,每集约10分钟,将针对 Robot 使用过程展开轻松的教学之旅。Massimo Banzi 将与 Arduino 的联合创办人 David Cuartielles,以及互动设计师 Xun Yang 一道展示趣味盎然的示例项目:

  1. Arduino Robot简介 -- 如何拆包、安装并使用Arduino集成开发环境(IDE)进行Robot程序设计

  2. LOGO 和遥控你的 Robot -- 在集成开发环境(IDE)中可从何处找到代码范例,以及如何使用电视遥控器来控制 Robot

  3. 避开障碍、创建策略 -- 采取不同的技术检测 Robot 与室内物体之间的距离

  4. 追踪直线前去救援 -- 如何使用电机板上的红外线数组传感器来追踪直线

  5. 影像与声音 -- 如何使用屏幕以及透过Robot的扬声器来播放声音

主程序: #include "gyro.h" #include "pid.h" #include "motor.h" #define dt 10 // in ms /* Object definitions and settings */ Gyro myGyro(dt); PIDControl pid(1.0,0,0.005,-255,255,dt); OmniMotorDriver omd; /* Deadzone definition. With a rotation of less than this value, * the robot will stand still */ double deadzone = 1.5; /* Buffers for timing, gyro data and PID outputs */ long lastMillis; double xAngle, yAngle; double xOut, yOut; /* Main setup call * Initializes Serial, the IMU and prepares the motor driver, * calbriates the IMU and enables the PID controller */ void setup() { pinMode(13, OUTPUT); Serial.begin(115200); if(!myGyro.init()) { while(1) { digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(2000); } } myGyro.calibrate(); omd.init(); pid.enable(); } /* Main loop * The main loop connects all the libraries and classes together, * in that it describes the order of function calls that is necessary * for the function of the robot */ void loop() { /* Save the current point in time in lastMillis */ lastMillis = millis(); /* Get Data from Gyro */ myGyro.update(&xAngle, &yAngle); /* Compute PID Output with the data */ pid.compute(xAngle, yAngle, &xOut, &yOut); /* Plot Angle on Serial Plotter Serial.print(xAngle); Serial.print(" "); Serial.print(yAngle); Serial.println(" "); */ /* Plot Angle on Serial Plotter Serial.print(xOut); Serial.print(" "); Serial.println(yOut); */ /* If any calculated angle is larger than the deadzone */ if(abs(xAngle) > deadzone || abs(yAngle) > deadzone) { /* Actually drive the motors */ omd.drive(xOut, yOut); /* Otherwise, stop them */ } else omd.stop(); /* Wait until the next dt cycle * if processing took less than dt, wait for the remaining time, * otherwise wait for the next full cycle to start * This is needed for gyro and PID accuracy */ int pTime = millis() - lastMillis; int resttime = (dt > pTime
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值