arduino进阶套件V2.0用户手册

合集下载

ARDUINO教程第二讲课稿

ARDUINO教程第二讲课稿

例程说明:
做一个按钮脉冲计时器,测一下按钮的 时间,测测谁的反应快,看谁能按出最 短的时间。
按钮接第3脚
int button=3;
int count;
void setup()
{pinMode(button,INPUT);
}
void loop()
{ count=pulseIn(button,HIGH);

发事件的程序。

1
1、attachInterrupt(interrput,function,mode);
该函数用于设置外部中断,函数有3个参数, 分别表示中断源,中断处理函数和触发模式。
中断源可选0或者1,对应2或者3号数字引脚。 中断处理函数是一段子程序,当中断发生时
执行该子程序部分。 触发模式有四种类型,LOW(低电平触发)、
CHANGE(变化时触发)、RISING(低电平 变为高电平触发)、FALLING(高电平变为低 电平触发)
例程原理
数字D2口接按钮开关,D4口接LED灯1(红 色)。D5口接LED2(绿色)。
在例程中,LED3每秒闪烁一次。使用中断0 来控制LED1,中断1来控制LED2。
按下按钮,马上响应中断,由于中断响应速 度快,LED3不受影响,继续闪烁。比查询的 效率要高。
}
void loop()
{ j=millis(); //不断读入当前时间值
if((j-i)>10000) //如果延时超过10秒,点亮LED
{digitalWrite(LED,HIGH);
}
else digitalWrite(LED,LOW);
}
4、micros()
该函数返回开机到现在运行的微秒值。 返回值是unsigned long .70分钟溢出。

ARDUINO教程第二讲课稿

ARDUINO教程第二讲课稿

1、analogReference(type)
该函数用于配置模拟引脚的参考电压。有3种 类型。
DEFAULT:默认值,参考电压是5V. INTERNAL:低电压模式,使用片内基准电压
源2.56V EXTERNAL:扩展模式,通过AREF引脚获取参
考电压。 注意:不使用本函数的话,默认是参考电压
CHANGE(变化时触发)、RISING(低电平 变为高电平触发)、FALLING(高电平变为低 电平触发)
例程原理
数字D2口接按钮开关,D4口接LED灯1(红 色)。D5口接LED2(绿色)。
在例程中,LED3每秒闪烁一次。使用中断0 来控制LED1,中断1来控制LED2。
按下按钮,马上响应中断,由于中断响应速 度快,LED3不受影响,继续闪烁。比查询的 效率要高。
int LED=13; //设置第13脚为LED输出引脚,内部连 上板上的LED灯。
void setup()
{ pinMode(button,INPUT); //设置为输入
pinMode(LED,OUTPUT); //设置为输出
}
void loop()
{ if(digitalRead(button)==LOW) //如果读取低电平
3、analogWrite(pin,value)
该函数是通过PWM的方式在引脚上输 出一个模拟量。
PWM——Pulse-Width Modulation——脉冲宽度调制 PWM输出的一般形式:
主要用于LED亮度控制,电机转速控制 等方面。
Arduino中的PWM的频率大约为490HZ。
UNO板上支持以下数字引脚(不是模拟 输入引脚)作为PWM模拟输出:3、5、 6、9、10、11. 板上带PWM输出的都有 ~号。

Arduino入门版使用教程

Arduino入门版使用教程

Arduino入門版使用教程目錄介紹篇 (1)一、Arduino 基礎套裝介紹 (2)1、什麼是Arduino 基礎套裝? (2)2、元件清單 (2)二、Arduino 介紹 (4)1、什麼是Arduino? (4)2、特色描述 (4)3、性能描述 (4)三、Arduino C 語言介紹 (6)1、關鍵字和符號 (6)2、結構 (9)3、功能 (9)四、Arduino 使用介紹 (11)1、準備好你的Arduino 板 (11)2、下載Arduino 開發環境 (13)3、安裝USB 驅動 (13)4、連接LED 燈電路 (17)5、打開arduino 開發環境 (18)6、打開已有程式 (19)7、編譯程式 (20)8、下載程式 (23)五、麵包板使用介紹 (30)1、麵包板介紹 (30)2、麵包板的使用 (30)實驗篇 (34)第一節多彩led 燈實驗 (35)一、發光二極管介紹 (35)二、簡單的控制一個led 燈的閃爍實驗 (39)三、廣告燈效果實驗 (41)第二節蜂鳴器實驗 (48)一、蜂鳴器介紹 (48)二、蜂鳴器模擬救護車警笛聲音實驗 (50)第三節數碼管實驗 (54)一、數碼管介紹 (54)二、數碼管顯示數字的實驗 (56)第四節按鍵實驗 (63)一、按鍵介紹 (63)二、按鍵控制led 等亮滅實驗 (65)三、擲骰子實驗 (67)第五節傾斜開關實驗 (74)一、傾斜開關介紹 (74)二、傾斜開關控制led 燈的亮滅 (75)第六節光控聲音實驗 (79)一、光敏電阻介紹 (79)二、光控聲音實驗 (80)第七節火焰報警實驗 (84)一、火焰傳感器介紹 (84)二、火焰報警實驗 (85)第八節搶答器實驗 (90)第九節溫度報警實驗 (98)一、溫度傳感器介紹 (98)二、溫度報警實驗 (99)第十節紅外遙控 (103)一、紅外接收頭介紹 (103)二、紅外遙控實驗 (104)介紹篇一、Arduino 基礎套裝介紹1、什麼是Arduino基礎套裝?Arduino基礎套裝是精心為初學者設計的一款學習工具。

arduino入门教程

arduino入门教程

Arduino是什么?开始讲之前跟大家普及一个知识点,Arduino是一个意大利品牌。

Arduino是一个开放源码电子原型平台,拥有灵活、易用的硬件(各种开发板)和软件(arduino IDE也就是编程器)。

吉安优创电子科技有限公司作为arduino国内为数不多的正版授权公司,坚持正版。

打击抵制各类盗版,改版,兼容版的侵权行为,也奉劝广大消费者不要去购买,以免带来不必要的麻烦。

Arduino专为设计师,工艺美术人员,业余爱好者,以及对开发互动装置或互动式开发环境感兴趣的人而设的。

Arduino能通过各种各样的传感器来感知环境,通过控制灯光、马达和其他的装置来反馈、影响环境。

板子上的微控制器可以通过Arduino的编程语言来编写程序,编译成二进制文件,烧录进微控制器对Arduino的编程是利用 Arduino编程语言 (基于 Wiring)和Arduino开发环境(based on Processing)来实现的。

基于Arduino的项目,可以只包含Arduino,也可以包含Arduino和其他一些在PC上运行的软件,他们之间进行通信 (比如 Flash, Processing, MaxMSP)来实现。

如何学习arduino认识Arduino UNOArduino UNO是Arduino入门的最佳选择,在编著本书时,其最新的版本为UNO R3,本书大部分内容都是基于Arduino UNO R3写成的。

Arduino UNO的详细组成信息如下图所示。

1. 电源(Power)Arduino UNO有三种供电方式:●通过USB接口供电,电压为5V;●通过DC电源输入接口供电,电压要求7~12V;●通过电源接口处5V或者VIN端口供电,5V端口处供电必须为5V,VIN端口处供电为7~12V。

2.指示灯(LED)Arduino UNO带有4个LED指示灯,作用分别是:● ON,电源指示灯。

当Arduino通电时,ON灯会点亮。

Arduino参考手册中文版

Arduino参考手册中文版

Arduino编程参考手册if (5)if...else . (6)for (8)switch case (10)while (11)do...while. (12)break (12)continue (13)return (14)goto (15)相关语法 (16)分号 (16)大括号 (16)注释 (18)define (19)include (20)算术运算符 (21)赋值 (21)加,减,乘,除 (21)取模 (22)比较运算符 (24)if(条件) and ==, !=, <, > (比较运算符) (24)布尔运算符 (26)指针运算符 (27)位运算 (27)位与 (27)位或 (28)位异或 (30)位非 (32)左移、右移 (33)复合运算符 (35)自加++ (35)自减-- (35)复合加+= (35)复合减-= (36)复合乘*= (36)复合除/= (36)复合与&= (36)复合或|= (36)变量 (36)宏定义 (38)整型常量 (39)浮点数常量 (41)数据类型 (41)void (41)boolean (42)char (43)unsigned char (43)byte (44)int (44)unsigned int (45)word (46)long (46)unsigned long (47)float (48)double (49)string (49)String(c++) (51)array (52)数据类型转换 (54)char() (54)byte() (54)int() (54)word() (55)long() (55)float() (56)变量作用域&修饰符 (56)变量作用域 (56)static (静态变量) (57)volatile (易变变量) (59)const (不可改变变量) (61)辅助工具 (61)sizeof() (sizeof运算符) (61)ASCII码表 (63)基本函数 (64)数字I/O (64)pinMode() (64)digitalWrite() (65)digitalRead() (67)模拟I/O (68)analogReference() (68)analogRead() (68)analogWrite() (69)shiftOut() (71)pulseIn() (72)时间 (73)millis() (73)delay(ms) (73)delayMicroseconds(us) (74)数学库 (75)min() (75)max() (75)abs() (76)constrain() (76)map() (76)pow() (78)sqrt() (78)三角函数 (78)sin(),cos(),tan() (78)随机数 (78)randomSeed() (78)random() (79)位操作 (79)设置中断函数 (80)a (80)achInterrupt() (80)detachInterrupt() (82)interrupts() (82)noInterrupts() (83)串口通讯 (83)begin() (84)available() (84)read() (86)flush() (87)print() (87)println() (91)write() (91)peak() (92)serialEvent() (92)程序结构(本节直译自Arduino官网最新Reference)在Arduino中, 标准的程序入口main函数在内部被定义, 用户只需要关心以下两个函数:setup()当Arduino板起动时setup()函数会被调用。

Arduino参考手册中文版

Arduino参考手册中文版

宏定义 (37)整型常量 (38)浮点数常量 (40)数据类型 (41)void (41)boolean (42)char (43)unsigned char (43)byte (43)int (44)unsigned int (45)word (46)long (46)unsigned long (47)float (48)double (49)string (49)String(c++) (51)array (52)数据类型转换 (54)char() (54)byte() (54)int() (55)word() (55)long() (56)float() (56)变量作用域&修饰符 (57)变量作用域 (57)static (静态变量) (58)volatile (易变变量) (60)const (不可改变变量) (61)辅助工具 (62)sizeof() (sizeof运算符) (62)ASCII码表 (63)基本函数 (65)数字I/O (65)pinMode() (65)digitalWrite() (66)digitalRead() (67)模拟I/O (68)analogReference() (68)analogRead() (69)analogWrite() (70)shiftOut() (71)pulseIn() (72)时间 (73)millis() (73)delay(ms) (73)delayMicroseconds(us) (74)数学库 (75)min() (75)max() (76)abs() (76)constrain() (76)map() (77)pow() (78)sqrt() (78)三角函数 (78)sin(),cos(),tan() (78)随机数 (79)randomSeed() (79)random() (79)位操作 (80)设置中断函数 (81)a (81)achInterrupt() (81)detachInterrupt() (82)interrupts() (83)noInterrupts() (83)串口通讯 (84)begin() (84)available() (84)read() (87)flush() (88)print() (88)println() (92)write() (92)peak() (93)serialEvent() (93)在这两个常量中false更容易被定义。

Arduino编程参考手册中文版

Arduino编程参考手册中文版

Arduino编程参考手册首页程序结构setup()loop()控制结构ifif...elseforswitch case whiledo...whilebreakcontinuereturngoto相关语法; 分号{ 大括号// 单行注释/**/ 多行注释#define 宏定义#include 文件包含算术运算符= 赋值+ (加)- (减)* (乘)/ (除)% (取模)比较运算符== 等于!= (不等于)< (小于)> (大于)<= (小于等于)>= (大于等于)布尔运算符&& (逻辑与)|| (逻辑或) ! (逻辑非)指针运算符* 指针运算符& 地址运算符位运算& (位与)| (位或)^ (位异或)~ (位非)<< (左移)>> (右移)复合运算符++ (自加)-- (自减)+= (复合加)-= (复合减)*= (复合乘)/= (复合除)&= (复合与)|= (复合或)围HIGH | LOWINPUT | OUTPUTtrue | false整型常量浮点数常量数据类型voidbooleancharunsigned charbyteintunsigned intwordlongunsigned longfloatdoublestringString(c++)array数据类型转换char()byte()int()word()long()float()变量作用域变量作用域static (静态变量)volatile (易变变量)const (不可改变变量)辅助工具sizeof() (sizeof运算符)ASCII码表数字I/OpinMode()digitalWrite()digitalRead()模拟I/OanalogReference()analogRead()analogWrite()指高级I/OshiftOut()pulseIn()时间millis()delay(ms)delayMicroseconds(us)数学库min()max()abs()constrain()map()pow()sqrt()三角函数sin(rad)cos(rad)tan(rad)随机数randomSeed() random() random()位操作lowByte()highByte()bitRead()bitWrite()bitSet()bitClear()bit()设置中断函数attachInterrupt()detachInterrupt()interrupts()noInterrupts()串口通讯begin()available()read()flushprint()println()write()peak()serialEvent()程序结构(本节直译自Arduino官网最新Reference)在Arduino中, 标准的程序入口main函数在部被定义, 用户只需要关心以下两个函数:setup()当Arduino板起动时setup()函数会被调用。

P-OEM V 2.0 用户手册和数据表说明书

P-OEM V 2.0 用户手册和数据表说明书

P-OEMV 2.0User Manual and DatasheetContentsWarnings.............................................................................................................Introduction.......................................................................................General information........................................................................................General functioning................................................................. P -OEM pressure range............................................................Contents..........................................................................................Description............................................................................................................Specifications.....................................................................................................RS232 Interface . (345)56678113HUIRUPDQFH and Options ............................................................. 6\QRSWLFV ............................................................................................ Nameplate and dimensions . (9)10Warranty and support (14)8•Warning signWarningsPrevent foreign objects or liquids from entering the P-OEM , this may cause a short-circuit failure or other malfunction.For P-OEMs with moisture control tubes, make sure the tube is ventilated adequately to prevent condensation droplets from forming .•Expose you to direct current/voltage in case the device is under voltage which may lead to severe damages •Void device’s warranty •Discharge our company from any liability regarding physical or device damagesConnect the 2 power cables to the correct voltageDo not place the product in an unstable location, place the unit in a location with a level surface and a strong and stable supportNot respecting the WARNINGScould:INTRODUCTIONThe P-OEM is a pressure-based flow controller for microfluidic and nanofluidic applications (microchannels, nanochannels, capillaries, lab on chip…). It offers excellent response time, pulseless and highly stable flow conditions for high precision industrial microfluidic applications. In addition, contamination is drastically reduced since the transferred liquid is not in contact with the instrument.The multi-channel design is highly compact and configurable: ranging from 1 to 8 channels, with optional on-board pressure and/or vacuum source and other possibilities.The advanced multi-channel flow-rate control software module combined with the FLOWELL device makes it possible to have full control on flow-rates in any coupled multi-channel configurations, while keeping the benefits of pressure actuation. The P-OEM Module offers low cost of ownership and relies on the patented pressure-based FASTABTM technology.GENERAL INFORMATION1.1 General functioningThe flow controllers MFCS TM -EZ series and P-OEM v ersions enable the flow actuation of fluids b y pressure r egulation. The principle is based on the pneumatic pressurization of reservoirs (external reservoirs as well as disposable cartridges or integrated wells) containing the fluids to be injected in the microfluidic systems. The original pneumatic path combined with a very fast regulation algorithm has been developed to deliver regulated pressure from a pressure source. The principle of pressure actuation in microfluidic systems is shown in the figure above and the benefits of this technology are listed below.The principle of pressure actuation is described hereafter: 1.Output pressures are controlled thanks to a dedicated software, A-i-O (All-in-One Fluigent Software). 2.The pressure actuators immediately and automatically provide the requested pressures with very high stability thanks to a feedback loop. 3.Connecting the pressure outputs to airtight reservoirs provides precise and smooth control of the sample flow into the microfluidic device.P-OEM Chip Software pressureReservoirs1.2 P-OEM pressure rangeDifferent types of P-OEM depending on the pressure rangesare available. One can mix together different pressure ranges.1.3 ContentsThe P-OEM package contains the following items , excluding advanced configurations :If any part is missing or damaged, please contact immediately•One P-OEM unit (with the differentpressure channels)•Optional USB or RS232 cable•Optional P-OEM pneumatic connectionkit (luer to barb adaptors, soft tube, back flow filters)•The user manual•Optional power supply 40W or other•Optional Fluigent software platform in aUSB stickDESCRIPTIONfittings), tampering can reduce the performance of the moduleNAMEPLATEP/N: P-OEM product numberS/N: P-OEM serial numberVoltage: power supply voltageDIMENSIONS*Dimensions are all in mm , see next page for slim andlarge module dimensionsSPECIFICATIONSPERFORMANCE AND OPTIONS0 - 25 mbar (0.4 psi)0 - 69 mbar (1 psi)0 - 345 mbar (5 psi)0 - 800 mbar (12 psi)0 - 1000 mbar (15 psi)0 - 2000 mbar (30 psi)0 - 7000 mbar (100 psi)0 - (-25) mbar (-0.4 psi)0 - (-69) mbar (-1 psi)0 - (-345) mbar (-5 psi)0 - (-800) mbar (-12 psi)Pressure stability0.1% full scale - CV (on measured values)Settling timeDown to 40ms (depends on output volume and setup)Pressure sensor resolution0.03% on full scale Power input24 VDC, Mascot connection available on demand Current input1.5 A Electrical connectorScrew terminals Connection - protocolUSB or RS232Weight 2 KgSlim board 19 x 9.5 x 6.5 cm (up to 3 channels)Standard board 19 x 14 x 6.5 cm (up to 4 channels)Large board 19 x 24 x 6.5 cm (up to 8 channels)Additional options such as air pump reduce the capacity for pressure channels / board Input pressure and flowRequirements depend on system characteristics, up to 7.2 bars Air consumptionThe system can be configured to minimize air consumption Pressurized mediaNon corrosive or explosive gas (Ambien air, N2, Ar, CO2), oil free and dry Optional on board pumpThe module can be configured to have an on-board or off-board pressure and or vacuum pump depending on needs ConnectionsSpeedfit Moisture control tube - WARNING, make sure the moisture control tube is well ventilatedInline air dryerPressure relief valveValve which will open at desired pressure min max levels includes a pressure inlet value display with flat ribbon cable attached to the P-OEM. User to integrate this signal/functionality into the system Purge valveValve channels for which you require a purge, see standard configuration in on page (11), other configurations can also be realized FlowboardA flowboard circuit can be integrated on the module to make use of flowrate sensor input, the board can be on or off the P-OEM module Coating Epoxy coatingOTHER CONFIGURATION OPTIONSSPECIFICATIONS AND PERFORMANCEPressure ranges up to 8 on one P-OEM module: The proportional valve assembly can be configured to be on or off the circuit boardELECTRICAL AND MECHANICAL PROPERTIES Size PRESSURE SUPPLY OPTIONSDryingPNEUMATIC SYNOPTICELECTRONIC SYNOPTICRS232 INTERFACEThe RS-232 interface is a 9-pin D-Sub socket used for remote communication. The voltage level is ±10 V (pin 5: GND; pin 2: RX +-10V; pin 3: TX +- 10V).Settings for the Serial parametersSerial Communication parameters should be set as follows:Baud Rate 115200 bpsStop Bits 1Parity No parityFlow Control NoneRemote Command SetThis remote command set is the default set availableon the instrument. All commands must be terminated with a <CR>. All decimal values use the point “.” as decimal separator.A query command ends with a question mark “?” for queries. The data column represents the response of the instrument. All response strings are terminated with a <CR>. Any response that have multiple parameters return the parameters separated by commas “,”.For all commands (no question mark “?”), the data column represents the required parameters to be sent to the instrument following the string in the command column. Any command that requires multiple parameters must have the parameters separated by commas “,”. In case of error in the commands spelling, the command is ignored by the instrument without error code returned.Commands/Queries related to an instrument connected at index “X” return "ERROR NO MODULE" in case there is no instrument at the index they refer to.Warranty termsWhat This Warranty Covers•This warranty is granted by Fluigent and applies in all countries•Your Fluigent product is guaranteed for one year from the date of delivery at your laboratory against defects in materials and workmanship•If found to be defective within the warranty period, your Fluigent product will be repaired or replaced free of chargeWhat This Warranty Does Not CoverThis warranty does not cover routine maintenance, or damage resulting from the failure to maintain the product in accordance with instructions provided by Fluigent. This warranty also does not cover damage that arises from accidental or intentional misuse or abuse, alteration or customization, or repaired by unauthorized persons. How to Get ServiceIf something goes wrong, contact the Fluigent dealer from whom you purchased your product. Arrange a mutually convenient time for Fluigent service representative to discuss over the problem and find a solution to fix the issue. Will be favored any remote repairs, but in case more actions need to be taken, the system will come back to Fluigent offices (for no additional cost, only if it is under warranty). The P-OEM warranty conditions are:•Do not apply a higher inlet pressure than the value advised by Fluigent•Do not use oil pump•Do not use any corrosive or toxic gas•Use a dry and clean gas•Do not use other cables than cables provided by Fluigent•Prevent foreign objects or liquids from entering the P-OEM and from spattering on the electronic card•Connect the 2 power cables to the correct voltage•Do not place the product in an unstable location, place the unit in a location with a level surface and a strong and stable support•Do not treat the P-OEM in order the clean it (autoclave)•Do not apply any electricity voltage on the P-OEM•Respect the temperature compatibility (from 5°C to 50°C)ContactsTechnical supportStill have questions? E-mail us at:********************or call our technical support team directly:Fluigent S.A.S.+33 1 77 01 82 65Fluigent Inc.+1 (978) 934 5283Fluigent GmbH+49 3641 277 652For a fully detailed FAQ for all Fluigent products visit: /faqs/Interested in our products?To view our complete product line along with applica-tion notes, please visit:For commercial requests, please e-mail:******************。

(最新整理)Arduino参考手册中文版

(最新整理)Arduino参考手册中文版

(完整)Arduino参考手册中文版编辑整理:尊敬的读者朋友们:这里是精品文档编辑中心,本文档内容是由我和我的同事精心编辑整理后发布的,发布之前我们对文中内容进行仔细校对,但是难免会有疏漏的地方,但是任然希望((完整)Arduino参考手册中文版)的内容能够给您的工作和学习带来便利。

同时也真诚的希望收到您的建议和反馈,这将是我们进步的源泉,前进的动力。

本文可编辑可修改,如果觉得对您有帮助请收藏以便随时查阅,最后祝您生活愉快业绩进步,以下为(完整)Arduino参考手册中文版的全部内容。

Arduino编程参考手册程序结构 (7)控制语句 (8)if (8)if。

..else (9)for (10)switch case (12)while (14)do。

while (14)break (15)continue (15)return (16)goto (17)相关语法 (18)分号 (18)大括号 (18)注释 (20)define (21)include (22)算术运算符 (23)赋值 (23)加,减,乘,除 (23)取模 (24)if(条件) and ==, !=, <,〉(比较运算符) (26)布尔运算符 (27)指针运算符 (29)位运算 (29)位与 (29)位或 (30)位异或 (32)位非 (33)左移、右移 (34)复合运算符 (36)自加++ (36)自减—— (36)复合加+= (37)复合减—= (37)复合乘*= (37)复合除/= (37)复合与&= (37)复合或|= (37)变量 (37)常量 (37)宏定义 (38)整型常量 (39)浮点数常量 (41)void (42)boolean (42)char (43)unsigned char (44)byte (44)int (44)unsigned int (46)word (46)long (47)unsigned long (47)float (48)double (49)string (49)String(c++) (51)array (52)数据类型转换 (54)char() (54)byte() (54)int() (54)word() (55)long() (55)float() (56)变量作用域&修饰符 (56)变量作用域 (56)static (静态变量) (57)volatile (易变变量) (59)const (不可改变变量) (60)辅助工具 (61)sizeof()(sizeof运算符) (61)ASCII码表 (62)基本函数 (63)数字I/O (64)pinMode() (64)digitalWrite() (65)digitalRead() (66)模拟I/O (67)analogReference() (67)analogRead() (67)analogWrite() (68)高级I/O (69)shiftOut() (69)pulseIn() (70)时间 (71)millis() (71)delay(ms) (72)delayMicroseconds(us) (73)数学库 (73)max() (74)abs() (74)constrain() (74)map() (75)pow() (76)sqrt() (76)三角函数 (76)sin(),cos(),tan() (76)随机数 (77)randomSeed() (77)random() (77)位操作 (78)设置中断函数 (79)a (79)achInterrupt() (79)detachInterrupt() (80)interrupts() (80)noInterrupts() (81)串口通讯 (82)begin() (82)available() (82)read() (84)flush() (85)println() (89)write() (89)peak() (90)serialEvent() (90)程序结构(本节直译自Arduino官网最新Reference)在Arduino中,标准的程序入口main函数在内部被定义, 用户只需要关心以下两个函数:setup()当Arduino板起动时setup()函数会被调用。

(完整)Arduino参考手册中文版

(完整)Arduino参考手册中文版

Arduino编程参考手册控制语句 (5)if (5)if。

.。

else (6)for (7)switch case (9)while (10)do。

.while (11)break (11)continue (12)return (12)goto (13)相关语法 (14)分号 (14)大括号 (14)注释 (16)define (17)include (18)算术运算符 (19)赋值 (19)加,减,乘,除 (19)取模 (20)比较运算符 (22)if(条件) and ==, !=, 〈,〉 (比较运算符) (22)布尔运算符 (23)指针运算符 (24)位运算 (25)位与 (25)位或 (26)位异或 (28)位非 (29)左移、右移 (30)复合运算符 (32)自加++ (32)自减—— (32)复合加+= (32)复合减—= (32)复合乘*= (32)复合除/= (33)复合与&= (33)复合或|= (33)变量 (33)常量 (33)宏定义 (34)整型常量 (35)浮点数常量 (37)数据类型 (37)void (37)boolean (38)char (39)unsigned char (39)byte (40)int (40)unsigned int (41)word (42)long (42)unsigned long (42)float (43)double (45)string (45)String(c++) (46)array (47)数据类型转换 (49)char() (49)byte() (49)int() (50)word() (50)long() (50)float() (51)变量作用域&修饰符 (51)变量作用域 (51)static (静态变量) (52)volatile (易变变量) (54)const (不可改变变量) (55)辅助工具 (56)sizeof()(sizeof运算符) (56)ASCII码表 (57)基本函数 (59)数字I/O (59)pinMode() (59)digitalWrite() (60)digitalRead() (61)模拟I/O (62)analogReference() (62)analogRead() (62)analogWrite() (63)高级I/O (64)shiftOut() (64)pulseIn() (65)时间 (66)millis() (66)delay(ms) (67)delayMicroseconds(us) (68)数学库 (68)min() (68)max() (69)abs() (69)constrain() (69)map() (69)pow() (71)sqrt() (71)三角函数 (71)sin(),cos(),tan() (71)随机数 (71)randomSeed() (71)random() (72)位操作 (72)设置中断函数 (73)a (73)achInterrupt() (73)detachInterrupt() (75)interrupts() (75)noInterrupts() (75)串口通讯 (76)begin() (76)available() (77)read() (78)flush() (80)print() (80)println() (83)write() (83)peak() (84)serialEvent() (84)程序结构(本节直译自Arduino官网最新Reference)在Arduino中,标准的程序入口main函数在内部被定义,用户只需要关心以下两个函数:setup()当Arduino板起动时setup()函数会被调用。

Arduino 智能小车套件用户指南说明书

Arduino 智能小车套件用户指南说明书

Arduino Smart Robot Car KitUser GuideV1.0 04.2017Table of Contents1. Introduction (3)2. Assembly (4)2.1 Arduino Uno R3 (4)2.2 HC-SR04 Ultrasonic Sensor Module with Bracket / Holder (5)2.3 L293D Motor Drive Expansion Board for Arduino (7)2.4 SG90 9g micro small servo motor (8)2.5 2WD Driver Motor Encoder Robot Smart Car Chassis Kits (9)3. Pin Definition (10)4. Installation (11)4.1 Installation of the Components (11)4.2 Installation of the Car (13)5. Start Programing (20)1.IntroductionThe UCTRONICS smart robot car kit is a flexible vehicular kit particularly designed for education, competition and entertainment purposes.The kit has an intelligence built in so that it guides itself whenever an obstacle comes ahead of it. An Arduino development is used to achieve the desired operation. With the help of a small servo motor, it scans the area left and right in order to find the best way to turn. An ultrasonic sensor unit is used to detect any obstacle ahead of it that sends a command to the Arduino Board. Depending on the input signal received, the Arduino microcontroller redirects the robot to move in an alternate direction by appropriately actuating the motors interfaced to it through a motor driver IC.When all the necessary components are getting together, a robot car comes up!A robot is a machine that can perform some task automatically or with guidance. Robotics is generally a combination of computational intelligence and physical machines (motors). Due to their high level of performance and reliability, the robot get the splendid popularity in our daily life.Come up, let’s go into a Robot World !1.1 Packing list➢1pcs Arduino UNO R3 Board➢1pcs HC-SR04 Ultrasonic Sensor Module➢1pcs Holder for HC-SR04➢1pcs L293D Motor Drive Expansion Board➢1pcs 9g micro servo motor➢1pcs servo motor Bracket➢Some cable end pin header as gift➢1set Car Chassis Kits:●2pcs 65mm tire Wheels●2pcs Geared Motors (1:48)●2pcs Speed Encoders●1pcs Universal Wheel●1pcs Battery Box●1pcs Car Chassis●1pcs Switch●Screws+ Nuts2. Assembly2.1 Arduino Uno R3This is the new Arduino Uno R3. In addition to all the features of the previous board, the Uno now uses an ATmega16U2 instead of the 8U2 found on the Uno (or the FTDI found on previous generations). This allows for faster transfer rates and more memory. No drivers needed for Linux or Mac (.inf file for Windows is needed and included in the Arduino IDE),and the ability to have the Uno show up as a keyboard, mouse, joystick, etc.The Uno R3 also adds SDA and SCL pins next to the AREF. In addition, there are two new pins placed near the RESET pin. One is the IOREF that allow the shields to adapt to the voltage provided from the board. The other is a not connected and is reserved for future purposes. The Uno R3 works with all existing shields but can adapt to new shields which use these additional pins.Note: The Arduino Uno R3 requires the Arduino 1.0 drivers folder in order to install properly on some computers. We have tested and confirmed that the R3 can be programmed in older versions of the IDE. However, the first time using the R3 on a new computer, you will need to have Arduino 1.0 installed on that machine. If you are interested in reading more about the changes to the IDE, check out the official Arduino 1.0 Release notes!2.1.1 Specifications➢Microcontroller: ATmega328➢Operating Voltage: 5V➢Input Voltage (recommended): 7-12V➢Input Voltage (limits): 6-20V➢Digital I/O Pins: 14 (of which 6 provide PWM output)➢Analog Input Pins: 6➢DC Current per I/O Pin: 40 mA➢DC Current for 3.3V Pin: 50 mA➢Flash Memory: 32 KB (ATmega328) of which 0.5 KB used by bootloader➢SRAM: 2 KB (ATmega328)➢EEPROM: 1 KB (ATmega328)➢Clock Speed: 16 MHz2.2 HC-SR04 Ultrasonic Sensor Module with Bracket / HolderThe HC-SR04 ultrasonic sensor module for Arduino is used for obstacle detection. Ultrasonicsensor transmits the ultrasonic waves from its sensor head and again receives the ultrasonic waves reflected from an object.Ultrasonic sensor general diagram2.2.1 Working PrincipleThe ultrasonic sensor emits the short and high frequency signal. These propagate in the air at the velocity of sound. If they hit any object, then they reflect back echo signal to the sensor. The ultrasonic sensor consists of a multi vibrator, fixed to the base. The multi vibrator is combination of a resonator and vibrator. The resonator delivers ultrasonic wave generated by the vibration. The ultrasonic sensor actually consists of two parts; the emitter which produces a 40kHz sound wave and detector detects 40 kHz sound wave and sends electrical signal back to the microcontroller.Ultrasonic working principleThe ultrasonic sensor enables the robot to virtually see and recognize object, avoid obstacles, measure distance. The operating range of ultrasonic sensor is 2 cm to 450 cm.2.2.2 Specification➢Working Voltage: 5V(DC)➢Static current: < 2mA➢Output signal: Electric frequency signal➢Output Voltage: 0-5V➢Sensor angle: <= 15 degrees➢Detection distance: 2cm-450cm➢High precision: Up to 0.3cm➢Input trigger signal: 10us TTL impulse➢Echo signal: output TTL PWL signal➢Mode of connection: VCC, trig (T), echo, GND➢Using method:(1)Supply module with 5V(2)Output will be 5V while obstacle in range, otherwise it will be 0V.➢Item size (mm): 44x20x152.2.3 Wiring diagram:HC-SR04 Ultrasonic Sensor Module ArduinoVCC5VTrig A4Echo A5GND GND2.3 L293D Motor Drive Expansion Board for ArduinoThis is a commonly used DC motor drive module, using L293D chip with small current DC motor driver. The pins are made compatible with Arduino which is easy to use.2.3.1 Specification➢ 2 connections for 5V servos connected to the Arduino's high-resolution dedicated timer - no jitter➢Up to 4 bi-directional DC motors with 4 PWM speed regulation➢Up to 2 stepper motor control, single / double step control, staggered or microstepping and rotation angle control➢ 4 H-Bridges: L293D chipset provides 0.6A per bridge (1.2A peak) with thermal shutdown protection, 4.5V to 36V➢Pull down resistors to keep motors in the state of rest during power-up➢Large terminal terminals make wiring easier (10 - 22AWG)➢With Arduino reset button➢The 2 terminals are connected to the external power supply terminals to ensure the separation of the logic and the motor drive powerVoltage DC 3V DC 5V DC 6VCurrent100MA 100MA 120MAReduction rate48:1RPM (with tire)100 190 240Tire Diameter66mmCar Speed (M/minute)20 39 48Motor Weight (g)50Motor Size (mm)70x22x18mmNoise<65dB2.4 SG90 9g micro small servo motorSG90 9g micro small servo motor is the main source of controlling action of the remote-control model. The module is widely applied in the field of fixed wing, helicopter, gliding, small robot, manipulator model.2.4.1 Specification➢Size (mm): 23x12.2x29➢Torsional moment: 1.5kg/cm➢Working voltage: 4.2-6V➢Temperature range : 0 ℃~55 ℃➢Operating speed: 0.1 seconds /60 degree➢Dead band width: 10 microseconds2.5 2WD Driver Motor Encoder Robot Smart Car Chassis KitsWith the car platform, adding micro-controller (such as Arduino) and sensor modules, then program it, a robot car comes up.All the module interface has been modified with XH2.54 ports as to make it much easier and convenient to assemble the car and reduce the chances for errors.2.5.1 Specification➢The car is the tachometer encoder➢With a 4 AA battery box➢Gear Motor reduction radio: 48:1➢Apply in distance measurement, velocity3. Pin DefinitionArduino UNO R3 BoardL293D Motor Drive Expansion Board4. Installation4.1 Installation of the Components Step 1Step 2Step 3Step 44.2 Installation of the Car Step 1Step 2Step 4Step 6Step 8Step 10Step 125. Start ProgramingFor examples and documentation, please visit:https:///UCTRONICS/Smart-Robot-Car-Arduino.gitIf any problems or suggestions for the tutorial or the robot car, please feel free to contact us by following ways:Skype: fpga4uTel: +86 025 ********Website: Email:*******************。

Emotron HCP 2.0 手持式控制面板 使用说明书

Emotron  HCP 2.0 手持式控制面板 使用说明书

Emotron HCP 2.0 Handheld control panel for Emotron FDU/VFX 2.0Emotron CDU/CDX 2.0Instruction manualEnglishHandheld control panel for Emotron FDU/VFX 2.0 and Emotron CDU/CDX 2.0The handheld control panel - HCP is a complete control panel, easy to connect to the variable speed drive, for temporary use when e.g. commissioning, servicing and so on.The HCP has full functionality including memory. It is possible to set parameters, view signals, actual values, fault logger information and so on. It is also possible to use the memory to copy all data (such as parameter set data and motor data) from one VSD (Variable Speed Drive) to the HCP and then load this data to other VSDs. For further information see Instruction manual for Emotron FDU/VFX 2.0 or Emotron CDU/CDX 2.0.Following cable kits are available:A.HCP cable for FDU/VFX Standard drives. 2 x 9-pin D-sub connectors, length 3 meters.B.HCP cable for CDU/CDX Compact drives.9-pin D-sub and RJ12 connectors (for connection to internal control board), length 3.3 meters.C.HCP cables for both CDU/CDX and FDU/VFX drives. One cable with 9-pin D-sub and RJ12 connectors + one cable with 2 x D-sub connectors.Connect the HCP to Emotron FDU/VFX 2.0It is easy to connect the HCP instead of the control panel or the blank panel in following way.1.Remove the control panel or the blank panel on theVSD. Then the RS232 connector will be visible.Fig. 1When you remove the blank panel or control panel you will be able to connect the HCP .B.Connect the standard RS232 cable, to the female connector on the VSD and to the connector on the HCP .Fig. 2RS232 cable for connecting the HCP to Emotron FDU/VFX 2.0C.Now it is possible to use the HCP .Part number Description01-5039-00Handheld Control Panel complete for FDU/VFX2.0 or CDU/CDX 2.0NOTE: When ordering the HCP it is important to specify if you are going to connect the HCP to Emotron FDU/VFX 2.0 or Emotron CDU/CDX2.0 so the correct cable kit is delivered.NOTE: It is important that only one control panel isconnected at the same time. Always remove/disconnect the existing control panel before connecting the HCP.Connect the HCP to Emotron CDU/CDX 2.0Fig. 3Adapter and cable for connecting the HCP toEmotron CDU/CDX 2.0.1.Mount the adapter to the RS232 connector on the HCP.B.Switch off the mains power supply.C.On Emotron CDU/CDX 008 - 018, remove the frontcover in order to expose the control board.Fig. 4Remove the front cover on EmotronCDU/CDX 008 - 018D.On Emotron CDU/CDX 026 - 046, remove the sidecover in order to expose the control board .Fig. 5Remove the side cover on EmotronCDU/CDX 026 - 046E.Disconnect the RJ12 cable from the built in controlpanel and connect the RJ12 cable from the HCPFig. 6Connect the HCP cable to the RJ12 connector on the control board.WARNING!Always switch off the mains voltage if it isnecessary to open the VSD and wait at least5 minutes to allow the capacitors todischarge.Remove the front coverRemove the side coverConnect theHCPcable to theRJ12 connector.F.Now it is possible to switch on the mains power supplyand use the HCP.WARNING!Be careful as the cover is open. Although theconnections for the control signals and theswitches are isolated from the main voltage, do not touch the control board when the variable speed drive is switched on.After having used the HCP, turn off the main power supply. Wait at least 5 minutes to allow the capacitors to discharge.1.Disconnect the cable from the control board. Reconnectthe cable from the built in control panel again.B.Mount the cover.C GD r i v e s & A u t o m a t i o n , 01-5925-01r 1 2015-04-20CG Drives & Automation Sweden ABMörsaregatan 12Box 222 25SE-250 24 Helsingborg SwedenT +46 42 16 99 00F +46 42 16 99 49/。

Arduino NUCLEO驱动模块用户手册说明书

Arduino NUCLEO驱动模块用户手册说明书

Motor Control ShieldUSER MANUALOVERVIEWThis module is a motor control expansion board of Arduino/NUCLEO. Onboard dual H-bridge driver chip D, allows to drive 4 DC motors or 2 stepping motors at one time.Arduino and STM32 examples are provided for users.FEATURES•Could drive 4 DC motors or 2 stepping motors at one time•Configurable motor power supply via onboard jumpero when using 5V motor power supply: drives four 5V DC motors at one timeo when using adjustable motor power supply: drives two 1.25V-6.45V DC motors at one time (9V external power supply is required)•Onboard dual H-bridge driver D x 2o each D can drive 2 DC motors or 1 stepping motor at one timeo totally 4 channel H-bridge, with 600mA output current (peak 1.2A) per single bridgeo ESD protectionPIN CONFIGURATIONMotor ControlArduino NUCLEO DC Motor Stepping Motor Shield3V 3V 3V N/A common terminalM1A D2 PA10DC motor 1 stepping motor 1 M1B D3 PB3M2A D4 PB5DC motor 2M2B D5 PB4M3A D7 PA8DC motor 3M3B D8 PA9stepping motor 2 M4A D12 PA6DC motor 4M4B D13 PA5M1EN D6 PB10 M1A, M1B EnableM2EN D9 PC7 M2A, M2B EnableM3EN D10 PB6 M3A, M3B EnableM4EN D11 PA7 M4A, M4B EnableNote: The M1EN, M2EN, M3EN and M4EN have not silk screen printing on board, they are hardware pins of L293 driver chips. You can enable them by setting them to HIGHDEMO CODEUse Arduino as example, shows how to control DC motor and stepping motor.1.DC motorTo control DC motor, you need to connect M1EN, M2EN, M3EN and M4EN to D6, D9, D10,D11 of Arduino. These are the PWM pin of Arduino, so we could control the speed of DC motorby controlling the Duty ratio of PWM.analogWrite(uint8_t pin, int value) used for writing analog pins. If set the parameter valueto 0, the pin will output LOW level,and if it is set as 255, the pins will output HIGH level whichduty ratio is 100%.To control a DC motor:Configure pin to output status firstly, then configure the initial status. Set D12 to LOW, D13 to HIGH (For changing the rotation direction, you can reverse the level of these pins). D11 is set to HIGH to enable the L293 driver chip.In the loop() function, the PWM duty ratio of D11 is set to 50% (value = 128 is equal to 50%). This value could control the speed of motor.2.Stepping motorFor example, control a 28BYJ-48 stepping motor: this motor is a 5-wires 4-phase motors. Connect it as below:Motor Control Shield 28BYJ-485V RedM1A OrangeM1B YellowM2A PinkM2B BlueBecause it uses M1A, M1B, M2A and M2B to do the timing control, here we need to setM1EN, M2EN to high to enable the L293Refer to documents of 28BYJ-48 we could get:1 2 3 4 5 6 7 8 P1-Red VCC VCC VCC VCC VCC VCC VCC VCC P2-Orange GND GND GND P3-Yellow GND GND GNDP4-Pink GND GND GNDP5-Blue GND GND GNDVoltage PhasePhaseresistorΩStepped-AngleReduction-gearratioStartfrequencyTorque NoiseDielectricStrength5V 4 50±10% 5.625/64 1:64 ≥550 ≥300 ≤35 600VAC The first figure shows how to control the control the 4-phase and 8-steps of motor:The 4 phases are A, B, C, D. If you want to make the A-phase on-state, you need to connect orange wire to GND, that is set M1A to Low.Control the other pins with the same way. If take the 4 Pins as 4-bits continuous data, we could use 8 bytes to control them: (orange pin is the lowest byte)Char BeatCode[8] = { //Stepper motor eight eight beat code0x0E, 0x0C, 0x0D, 0x09, 0x0B, 0x03, 0x07, 0x06};The second figure shows the frequency parameters of control:There is start frequency, it explains the maximum pulse rate of stepping motor while no-load starting. If the pulse rate is higher that this value, the motor could not work. The value is ≥550, Its uint is P.P.S means pulses per second. It is that motor could start properly if you input550 pulses every second. And we could get that, every pulse cause 1s/550=1.8ms. So if the time interval longer than 1.8ms, the motor could work. Of cause the longer the interval, the longer motor rotates one step.With the information above, we could rotate the motor, but still cannot control it precisely.28BYJ-48 is a geared motor. The reduction-gear ratio is 1:64. The output shaft rotate a roundwhen the rotator turns 64 rounds, it is that 64*64=4096 pulses are required for a round, If every pulse cost 2ms, it requires 2ms*4096=8192ms, about 8s. In fact, the real ratio generally isn’t equal to standard value. Here we use value 4076 pluses after testing, the tolerance is about0.56‰. The main code is that:。

ARDUINO 升级版入门套件课程

ARDUINO 升级版入门套件课程

delay(200);
//延遲
}
for (int i = BASE; i < BASE + NUM; i ++)
{
digitalWrite(i, HIGH); //設定數字I/O腳輸出為"低",即逐漸開燈
第 10 页 共 71 页
delay(200); } }
//延遲
例程5. 交通灯设计实验
上面我们已经完成了单个小灯的控制实验,接下来我们就来做一个稍微复杂一点的交通灯实 验,其实聪明的朋友们可以看出来这个实验就是将上面单个小灯的实验扩展成3 个颜色的小 灯,就可以实现我们模拟交通灯的实验了。我们完成这个实验所需的元件除了Arduino 控制 器和下载线还需要的硬件如下: 红色M5 直插LED*1 黄色M5 直插LED*1 绿色M5 直插LED*1 220Ω电阻*3 面包板*1 面包板跳线*1 扎 准备好上述元件我们就可以开工了,我们可以按照上面小灯闪烁的实验举一反三,下面是我 们提供参考的原理图,我们使用的分别是数字10、7、4、接口.
第 2 页 共 71 页
例程2、LED 闪烁实验
LED 小灯实验是比较基础的实验之一,上一个“Hello World!”实验里已经利用到了Arduino 自带的LED,这次我们利用其他I/O 口和外接直插LED 灯来完成这个实验,我们需要的实验 器材除了每个实验都必须的Arduino 控制器和USB 下载线以外的 其它器件如下: 红色M5 直插LED*1 220Ω直插电阻*1 面包板*1 面包板跳线*1 扎 下一步我们按照下面的小灯实验原理图链接实物图,这里我们使用数字10 接口。使用发光 二极管LED 时,要连接限流电阻,这里为220Ω电阻,否则电流过大会烧毁发光二极管。 小灯实验原理图

ARDUINO教程第二讲

ARDUINO教程第二讲

1、attachInterrupt(interrput,function,mode);

该函数用于设置外部中断,函数有3个参数, 分别表示中断源,中断处理函数和触发模式。 中断源可选0或者1,对应2或者3号数字引脚。 中断处理函数是一段子程序,当中断发生时 执行该子程序部分。 触发模式有四种类型,LOW(低电平触发)、 CHANGE(变化时触发)、RISING(低电平 变为高电平触发)、FALLING(高电平变为低 电平触发)

该函数是通过PWM的方式在引脚上输 出一个模拟量。
PWM——Pulse-Width Modulation——脉冲宽度调制
PWM输出的一般形式:



主要用于LED亮度控制,电机转速控制 等方面。 Arduino中的PWM的频率大约为490HZ。 UNO板上支持以下数字引脚(不是模拟 输入引脚)作为PWM模拟输出:3、5、 6、9、10、11. 板上带PWM输出的都 有~号。 注意:PWM输出位数为8位,从0~255
Arduino语言是建立在C/C++基础上的,其实也就 是基础的C语言,Arduino语言只不过把AVR单片机 (微控制器)相关的一些参数设置都函数化,不用我 们去了解他的底层,让我们不了解AVR单片机(微控 制器)的朋友也能轻松上手。
Arduino语言
关键字: if if...else for switch Case while do ... while break continue return goto
Arduino语言
语法符号: ;
{} // /**/ 运算符: = + * / %
Arduino语言
数据类型: boolean 布尔类型 char byte 字节类型 int unsigned int long unsigned long float double string array void 数据类型转 换: char() byte() int() long() float()

ArduBlock教程

ArduBlock教程

ArduBlock教程本文为您介绍ArduBlock中文版界面及功能使用说明,欢迎阅读ArduBlock中文版下载:启动ArduBlock之后,我们会发现它的界面主要分为三大部分:工具区(上),积木区(左),编程区(右)。

其中,工具区主要包括保存、打开、下载等功能,积木区主要是用到的的一些积木命令,编程区则是通过搭建积木编写程序的区域。

下面将分别介绍这三个区域。

一、工具区工具区包括“新增”“保存”“另存为”“打开”“上载到Arduino”“Serial Monitor”,“新增”就是新建,“保存”“另存为”“打开”也都是其它软件的常用工具,这里就不做介绍了。

点击“上载到Arduino”,Arduino IDE将生成代码,并自动上载到Arduino板子,需要注意的是在上载Arduino之前,要查看一下端口号和板卡型号是否正确。

在点击“上载到Arduino”之后,我们可以打开Arduino IDE查看程序是否上载成功。

“Serial Monitor”则是打开串口监视器,串口监视器只有在电脑中有Arduino端口时才能打开。

二、积木区积木区包含了《Arduino创意机器人》课程中用到的所有模块,还包括有一些课程中没有涉及但经常用到的模块。

积木区的积木共分为七大部分:控制,引脚,逻辑运算符,数学运算,变量/常量,实用命令,教育机器人。

1.控制控制中的各个模块都是一些最基本的编程语句,只要接触过编程的人都会很容易理解这里面的各个模块的含义。

控制中各模块释义如表1所示。

2.引脚引脚中的各个模块是针对Arduino板的引脚(也称针脚)所设计的,主要是数字针脚和模拟针脚,也包括一些常见的使用,比如舵机,超声波等。

引脚中各模块释义如表2所示。

3.逻辑运算符逻辑运算符主要包括常见的“且”“或”“非”,还包括比较运算符,如数字值、模拟值和字符的各种比较。

逻辑运算符中各模块释义如表3所示。

4.数学运算数学运算主要是Arduino中常用的基本运算,包括四则运算、三角函数、函数映射等。

Arduino兼容全功能驱动板-用户指南

Arduino兼容全功能驱动板-用户指南

Arduino兼容全功能驱动板Arduino是一款很好的电子制作入门,有了电机扩展板可以很好的成为机器人开发平台。

这里介绍一款能驱动各种简单到稍复杂项目的全功能的电机扩展板。

这是一款常用的直流电机驱动模块,采用293D芯片小电流直流电机驱动芯片。

管脚被做成了Arduino兼容的,也方便了爱好者快速的基于Arduino的开发。

* 2个5V伺服电机端口联接到Arduino的高解析高精度的定时器-无抖动!* 多达4个双向DC 电机各自带有8位速度选择(大约0.5%的解析度)* 多达2个步进电机(单极或双极) 单线圈,双线圈,交错或微步。

* 4路H-桥:L293D 芯片每路桥提供.0.6A(峰值1.2A)电流并且带有热断电保护,4.5V to 36V。

* 下拉电阻保证在上电时电机保持停止状态。

* 大终端接线端子使接线更容易(10 - 22AWG)和电源。

* 带有Arduino复位按钮。

* 2个大终端外部电源接线端子保证逻辑和电机驱动电源分离。

* 兼容Mega, Diecimila, & Duemilanove。

* 全部配件可以从探索者网店买到。

*下载方便使用的Arduino软件库快速进行开发。

使用指南特别说明:要使用这款驱动你需要安装库文件到Arduino-IDE中,除非你自己知道怎么写驱动程序,嘿嘿!只要将库文件解压到Arduino安装目的的libraries目录下即可例如:D:\Program Files\arduino-0021\libraries然后重新打开Arduino IDE就可以使用了有例子代码可供参考直流电机供电电压和电流需求电机需要很多的能量,尤其是便宜的电机因为它们效率很低。

最重要的是要搞清楚电机将要使用的电压。

如果你幸运的话你的电机可能会有某种参数规格。

一些小的业余电机仅运行在1.5V,但它们常被用作6V或者12V电机来使用。

这款电机驱动被设计成可以运行从4.5V 到36V(无论如何,在理论上来说应该可以降低到大概2.5V)。

控制器2.0说明书 (1)

控制器2.0说明书 (1)

控制器使用说明书V2.0第一章概述 (2)第二章操作说明 (3)2.1面板说明 (3)2.2 按键定义说明 (4)2.3 数码管显示说明 (4)2.4操作步骤 (5)2.4.1报站操作 (5)2.4.2线路下载操作 (5)2.4.3线路选择操作 (6)2.4.4配置文件的创建 (6)第三章安装与接线 (7)3.1外形尺寸和安装说明 (7)3.1.1外形尺寸 (7)3.1.2 控制器安装 (8)3.2接线定义 (9)3.3安装说明 (9)3.3.1安装环境要求 (9)3.3.2安装注意事项 (10)3.3.3 安装部件和材料要求 (10)附件1:线路txt文件内容编写说明 (11)附件二:TXT文件示例 (15)第一章概述感谢您使用V2.0控制器。

本手册提供用户关于安装、运行操作、异常诊断等方面的使用方法,为确保V2.0控制器的稳定运行,在安装使用之前,请仔细阅读本说明书并妥善保存。

V2.0控制器是专为公交系统设计的一款控制LED电子路牌的产品。

它采用了嵌入式微处理器和嵌入式系统,结合了USB通信技术、RS485通信技术,实现了电子路牌的中央控制,信息下载及线路管理。

外观简洁、抗震,安装灵活方便,功能强大,系统运行稳定,可广泛应用于城市公交系统。

V2.0控制器具有以下功能:与LED电子路牌联动,自动更新线路号、首末站点信息;可以保存32条线路,方便车辆调度;可根据不同客户需求更新相应字库(黑体、细黑、宋体……);车内屏报站,可以控制下一站或即将到站的信息显示;控制站节牌站点号显示及上下行信息;满足第三方协议,更新路牌线路信息;键盘控制(3个按键),方便设置或手动报站;3位数码管显示线路号、站点号、上下行信息等;USB接口,自动下载线路信息、字库文件、广告屏信息(由配置文件);宽电源输入:DC 9~36V控制器2.0系统框架图第二章操作说明2.1面板说明图2.1 控制器的面板按键说明图1)按键:共4个按键,每个按键分长按键和短按键功能,操作人员可通过按键设置控制器;2)USB接口:下载线路信息(或广告屏显示信息);切记:勿用该接口给手机充电;3)指示灯:◆电源指示灯:通电状态下电源指示灯亮;◆USB指示灯:灯亮表示接入的U盘被识别,开始自动下载线路信息;◆报站指示灯:灯亮表示此时控制器为报站状态,按<、ok、>等键可以控制车内屏报站,或长按<、>键控制上、下行方向,控制器开机时默认为报站状态;◆线路指示灯:灯亮表示此时控制器为线路选择状态,按<、ok、>等键可以选择存储在控制器内的某一条线路信息;4)显示区:3位数码管显示线路号站点号、上下行信息;2.2 按键定义说明2.1按键定义说明按键功能短按此键:上翻选择键,出站键,播放屏幕显示站点的上一站出站信息。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

版权声明YFROBOT团队(以下简称YFROBOT)对该手册保留一切权力,非经YFROBOT授权同意(书面形式),任何单位及个人不得擅自摘录本手册部分及全部内容用于商业用途,违者将追究其法律责任。

用户可以在互联网上分享传播,以方便更多人,但必须保证手册的完整性。

前言2013年5月,YFROBOT工作室对原有的Arduino入门套件进行了更新升级,推出了Arduino 进阶套件。

这份《Arduino入门与提高》是升级套件推出的第一版使用手册,它存在的目的:让不懂Arduino的用户更快的上手,让入门的用户有更多玩的。

希望大家掌握基础知识后,能够更快的投入到实际应用中去,去做一些小项目,而不是一直停留在做小实验,搭线这些初级体力劳动上。

《Arduino入门与提高》手册里每一篇实验都图文并茂,所用到的器件及实验插图均为实物拍摄,每一个程序同样都经过严格的实验认证,并努力做到详细。

对于刚入门的初阶用户而言,我们推荐您从头开始,从最简单的实验开始,循序渐进,才能有所提高。

不能说觉得液晶好玩,一开始就去做液晶显示的实验,这样往往都不会成功,因为液晶的实验我们可能用到外部的扩展库,如果前面的章节你不去了解,就会增加困惑,间接的也浪费了时间。

我们要抱着学习的心态,即使是再简单的实验也不放过,并能够做到举一反三进行扩展,这样才更容易学到知识。

对于一些来源于网络或者其他渠道的资料,我们有义务保证资料正确详尽,并进行实验认证。

限于篇幅无法概全的内容,我们也都会注明出处,有兴趣的用户可以深入了解。

《Arduino入门与提高》手册的编写凝聚了YFROBOT工程师大量的心血,因此仅作为进阶套件的使用说明书,您可以随意在网上传播,但必须手册的完整性,本手册严禁用于商业用途。

对于商用的行为,表示强烈的鄙视,并保留追究法律责任的权利。

YFROBOT团队2013年5月v1.0版ARDUINO官方网址:YFROBOT论坛地址:更新说明修订版本升级内容V1.02013.051、初始版本V1.1 2013.08 1、增加实验平台2、增加点阵显示单元3、修正部分插图BUGV1.2 2013.12 1、1602LCD液晶升级IIC 1602 LCD 液晶2、半幅面包板(400孔)升级MB102 大面包板(830孔)3、双倍面积实验平台4、增加6节电池盒5、新增电阻收纳盒(3个)6、新增触控开关模块7、修正手册内容V1.3 2014.07 1、增加蓝牙无线传输模块2、增加液晶显示线序定义标签V2.0 2014.09 增加74HC164集成芯片增加DS1302时钟显示增加直流电机及风扇增加U型光电开关增加红外发射管对包装盒进行全面升级一、Arduino UNO介绍1.简介A rduino是一个开源电子成型平台基于灵活、易于使用的硬件和软件。

这是特意为艺术家、设计师、业余爱好者,任何有兴趣创建交互式对象和环境。

Arduino UNO是Arduino USB接口系列的最新版本,作为Arduino平台的参考标准模板。

UNO的处理器核心是ATmega328P,该学习套件使用了YFROBOT团队推出的全新Bluebird UNO R3兼容板,下面是与原版之间的比较:功能Bluebird UNO R3兼容版Arduino UNO R3处理器ATMEGA328P-AU ATMEGA328P-PU工作电压5V 5V输入电压6-15V 7-12V数字引脚14个(6路PWM)14个(6路PWM)模拟引脚8个6个工作时钟16M 16M通信芯片FT232RL ATMEGA16U2Boot自修复是否Bluebird UNO R3因为采用了贴片封装的atmega328p芯片,因此比官方版本的UNO多了2路AD转换功能。

通信芯片则采用了FT232RL,具有驱动安装简单,通信质量稳定等优点,即使主板Bootloader意外丢失,也可以利用其自带的bitbang模式重新固化bootloader。

用户使用Bluebird R3开发的arduino互动作品,可以随意在互联网上分享传播,不存在侵权行为。

如果使用仿制版的UNO,这一点是被禁止的。

Arduino IDE安装与介绍1.下载Arduino IDE编译器下载:/en/Main/Software这里使用WIN 64位系统,所以选择Windows Installer,Windows(ZIP file);如果您是Mac 或者Linux,请选择对应版本。

软件免安装,解压后即可正常使用,双击“arduino.exe”打开,即可进行程序编写与程序下载。

2.驱动安装将Arduino UNO板通过随机附赠的USB线连接到电脑,会提示安装驱动。

(这里使用Win7 64位操作系统)若没有弹出对话框,右击“计算机”>“属性”>“设备管理器”,找到“未知设备”后右击“属性”,点击“更新驱动程序”。

选择“浏览计算机以查找驱动程序软件”。

选择驱动程序所在目录,然后单击下一步。

注:不同电脑路径不同,驱动文件在“drivers”的下级目录“FTDI USB Drivers”文件夹中。

如果使用的是UNO官方版本主板,驱动程序的安装目录选择“drivers”文件夹即可。

Windows下安装时会弹出安全警告,选择“始终安装此驱动程序软件”后等待几秒钟驱动便能够安装成功。

安装成功后,在电脑“设备管理器”>“端口(COM和LPT)”中便能够查看到虚拟映射端口,如下图所示:注:不同电脑映射端口不同,以实际安装显示为准。

右击“USB Serial Port”>“属性”>“端口设置”>“高级”,可以进行如下设置:3.Arduino IDE的界面介绍及使用Arduino集成开发环境(IDE)是一个可以在你的计算机里运行的软件,你可以通过它来为你的Arduino主板上传不同的程序,而arduino的编程语言也是由Processing语言改编而来的。

它的奇妙之处在于,当你把程序上传到Arduino时,会自动将你的代码转化为C代码,再通过开源的avr-gcc编译器将代码编译成微处理器能够识别的指令。

这是Arduino非常重要的一部分,它隐藏了复杂的编译过程,用尽可能简单的方式让你使用你的控制板。

1)IDE界面介绍程序编译,检查程序编译是否正确。

程序下载,将编译好的程序下载到arduino控制板中。

新建空白编辑窗。

打开保存过的程序,打开一个计算机里已经存在的arduino程序。

保存当前程序,将当前程序保存到计算机里。

串口监视器,可以透过串口来查看变量值,传感器数据等。

对于习惯使用中文界面的用户而言,需要在“File”>“Preferences”>“Editor language”里选择“简体中文”,然后重启arduino IDE即可切换至中文显示窗口。

下载之前还需要对“Tools”菜单下的“Board”和“Port”分别进行设置,其中“Board”系统默认选择Arduino UNO。

Bluebird UNO R3因为使用的也是官方的UNO固件,因此两者之间完全兼容,这里选择Arduino UNO。

“Port”用于设置通信端口号,选择之前安装驱动时的映射端口即可。

2) 先下载一个程序我们以官方给的小例子Blink为例,首先打开测试程序Blink,点击File > Examples > 01.Basics > Blink,如图:控制器类型:选择Tools > Board > Arduino UNO(若使用其他板子请选择对应型号),如下图所示:板子的COM端口:选择Tools > Serial Port > COM5,先点编译,再点下载,等待程序上传完成,如下图所示:下载程序成功后,控制板上的L 指示灯会以1S 的频率闪烁,说明程序下载成功并完美运行。

实验1:LED 灯的实验发光二极管(英语:Light-Emitting Diode )简称LED ,是一种能够发光的半导体电子元件。

常见的LED 发光管如图1-1所示。

发光二极管的长脚是正极,短脚是负极,使用时要注意不要接反。

发光二极管的反向击穿电压约5V 。

由于它的正向伏安特性曲线很陡,使用时必须串联限流电阻来控制流经发光二极管的电流,限流电阻R 可用下式计算:R=(E -U )/I ;式中的E 为电源电压,U 为LED 的正向压降(红、 黄色发光管压降通常为2.0V ,白、蓝等发光管压降通常为3.0V ),I 为LED 工作电流(通常10-20ma ),所以电压一定,电流越大,发光管发出的光越强。

通常发光管的限流电阻取值范围为220R -1K ,电阻值取200R 时最亮,1K 则相对有些暗。

1-1:单个LED 灯的闪烁实验利用主板自带的LED 来完成实验,它连接在arduino 数字引脚“13”上,标识为“L ”,位于电源指示灯“ON ”的上方。

当在13引脚施加一个高电平时,灯导通点亮;当在13引脚施加一个低电平时,灯截止熄灭。

用户还可以自己搭建硬件电路,如图1-2所示。

图1-1:3mm LED 发光管图1-2:LED发光电路void setup(){pinMode(13,OUTPUT); // 初始化数字引脚,使其为输出状态.}void loop(){digitalWrite(13,HIGH); // 配置13引脚为高,点亮LEDdelay(1000); // 持续1秒钟digitalWrite(13,LOW); // 配置13引脚为低,熄灭LEDdelay(1000); // 持续1秒钟.}上面的示例代码即为一个基本的arduino程序框架,也就是说,当我们编写一段arduino代码时,想要程序能够编译通过,那么必须包含以下两个函数,否则编译器会报错。

setup() 程序上电开始时执行,完成寄存器和函数初使化的工作,只执行一次loop () 函数内的程序无限循环执行,相当于C语言里的while(1){};arduino上电默认所有IO口工作在输入模式,所以作为输入的IO口不需要再定义;作为输出的IO口则需要在程序初使化中定义对应引脚为OUTPUT(用作输出)。

#pinMode(pin,mode) 数字IO口输入输出模式定义函数,pin表示为“0~13”,mode表示为“INPUT”或“OUTPUT”,必须大写.* arduino函数名命名规则为第一个单词首字母小写,第二个单词首字母大写的形式,所以“pinMode”区分大小写.# digitalWrite(pin,value)数字IO口输出电平定义函数,pin表示为0~13,value表示为HIGH或LOW.* “HIGH”、“LOW”必须为大写.有用户会奇怪,为什么arduino不能像其他控制器那样直接对IO口进行赋值,而是通过digitalWrite()这样的语句来实现.因为arduino的设计初衷就是方便广大的爱好者,不必花时间拘泥于细节,自带的IDE平台封装了大部分底层函数,通俗易懂.# delay(ms) 延时函数,单位为ms,值为1000时表示1000ms,即1秒.# delayMicroseconds(us) 延时函数单位为us,值为1000时表示1000us及1ms.以“//”开头的代码会被编译器忽略,注释是用来解释代码行的文字,这对于想要了解代码内容的人非常有帮助,在编写复杂代码时,有良好的注释风格也有利于代码的维护。

相关文档
最新文档