Arduino参考手册 - 修正
- 格式:pdf
- 大小:387.11 KB
- 文档页数:13
Product Reference ManualSKU: ABX00083DescriptionThe Arduino Nano ESP32 (with and without headers) is a Nano form factor board based on the ESP32-S3 (embedded in the NORA-W106-10B from u-blox®). This is the first Arduino board to be based fully on an ESP32, and features Wi-Fi®, Bluetooth® LE, debugging via native USB in the Arduino IDE as well as low power.The Nano ESP32 is compatible with the Arduino IoT Cloud, and has support for MicroPython. It is an ideal board for getting started with IoT development.Target areas:Maker, Debugging, IoT, MicroPythonFeaturesXtensa® Dual-core 32-bit LX7 Microprocessor Up to 240 MHz384 kB ROM512 kB SRAM16 kB SRAM in RTC (low power mode)DMA ControllerPowerOperating voltage 3.3 VVUSB supplies 5 V via USB-C® connectorVIN range is 6-21 VConnectivityWi-Fi®Bluetooth® LEBuilt-in antenna2.4 GHz transmitter/receiverUp to 150 MbpsPins14x digital (21x including analog)8x analog (available in RTC mode)SPI(D11,D12,D13), I2C (A4/A5), UART(D0/D1) Communication PortsSPII2CI2SUARTCAN (TWAI®)Low Power7 μA consumption in deep sleep mode240 μA consumption in light sleep modeRTC MemoryUltra Low Power (ULP) CoprocessorPower Management Unit (PMU)ADC in RTC mode55556778888999910101011111111121212131313131314151516Contents1 The Board1.1 Application Examples 2 ESP32 Core3 Recommended Operating Conditions4 Block Diagram5 Board Topology5.1 Front View6 NORA-W106-10B (Radio Module / MCU)6.1 Xtensa® Dual-Core 32bit LX7 Microprocessor 6.2 Wi-Fi®6.3 Bluetooth®7 System7.1 Resets 7.2 Timers 7.3 Interrupts8 Serial Communication Protocols8.1 Inter-Integrated Circuit (I2C)8.2 Inter-IC Sound (I2S)8.3 Serial Peripheral Interface (SPI)8.4 Universal Asynchronous Receiver/Transmitter (UART)8.5 Two Wire Automotive Interface (TWAI®)9 External Flash Memory 10 USB Connector 11 Power Options11.1 Power Tree 11.2 Pin Voltage 11.3 VIN Rating 11.4 VUSB11.5 Using the 3.3 V Pin 11.6 Pin Current 12 Pinout12.1 Analog (JP1)12.2 Digital (JP2)13 Mounting Holes And Board Outline161617171717174191920202014 Board Operation14.1 Getting Started - IDE14.2 Getting Started - Arduino Web Editor 14.3 Getting Started - Arduino IoT Cloud 14.4 Online Resources 14.5 Board Recovery15 Declaration of Conformity CE DoC (EU)16 Declaration of Conformity to EU RoHS & REACH 211 01/19/202117 Conflict Minerals Declaration 18 FCC Caution19 Company Information 20 Reference Documentation 21 Change Log1 The BoardNano ESP32 is a 3.3 V development board based on the NORA-W106-10B from u-blox®, a module that includes a ESP32-S3 system on a chip (SoC). This module has support for Wi-Fi® and Bluetooth® Low Energy (LE), with amplified communication through a built-in antenna. The CPU (32-bit Xtensa® LX7) support clock frequencies at up to 240 MHz and has native support for debugging via the USB-C® connector.1.1 Application ExamplesHome automation: an ideal board for automating your home, and can be used for smart switches, automatic lighting and motor control for e.g. motor controlled blinds.IoT sensors: with several dedicated ADC channels, accessible I2C/SPI buses and a robust ESP32-S3 based radio module, this board can easily be deployed to monitor sensor values.Low power designs: create battery powered applications with low power consumption, utilising the built in low power modes of the ESP32-S3 SoC.2 ESP32 CoreThe Nano ESP32 uses the Arduino Core for ESP32 boards, a derivation of Espressif's arduino-esp32 core. Rating3 Recommended Operating ConditionsSymbol Description Min Typ Max UnitV IN Input voltage from VIN pad67.021VV USB Input voltage from USB connector 4.8 5.0 5.5VT OP Operating Temperature-402585°CFunctional Overview4 Block DiagramArduino Nano ESP32 Block Diagram5 Board Topology5.1 Front ViewTop View of Arduino Nano ESP32 Ref.DescriptionM1NORA-W106-10B (ESP32-S3 SoC)J1CX90B-16P USB-C® connectorJP11x15 analog headerJP21x15 digital headerU2MP2322GQH step down converterU3GD25B128EWIGR 128 Mbit (16 MB) ext. flash memory DL1RGB LEDDL2LED SCK (serial clock)DL3LED Power (green)D2PMEG6020AELRX Schottky DiodeD3PRTR5V0U2X,215 ESD Protection6 NORA-W106-10B (Radio Module / MCU)The Nano ESP32 features the NORA-W106-10B stand alone radio module, embedding an ESP32-S3 series SoC as well as an embedded antenna. The ESP32-S3 is based on an Xtensa® LX7 series microprocessor.6.1 Xtensa® Dual-Core 32bit LX7 MicroprocessorThe microprocessor for the ESP32-S3 SoC inside the NORA-W106 module is a dual-core 32-bit Xtensa® LX7. Each core can run at up to 240 MHz and has 512 kB SRAM memory. The LX7 features:32-bit customized instruction set128-bit data bus32-bit multiplier / dividerSupport for JTAG debuggingThe LX7 has a 384 kB ROM (Read Only Memory), and 512 kB of SRAM (Static Random Access Memory). It also features an 8 kB RTC FAST and RTC SLOW memory. These memories are designed for low-power operations, where the SLOW memory can be accessed by the ULP (Ulta Low Power) coprocessor, retaining the data in deep sleep mode.6.2 Wi-Fi®The NORA-W106-10B module supports the Wi-Fi® 4 IEEE 802.11 standards b/g/n, with an output power EIRP at up to 10 dBm. The max range for this module is 500 meters.802.11b: 11 Mbit/s802.11g: 54 Mbit/s802.11n: 72 Mbit/s max at HT-20 (20 MHz), 150 Mbit/s max at HT-40 (40 MHz)6.3 Bluetooth®The NORA-W106-10B module supports Bluetooth® LE v5.0 with an output power EIRP at up to 10 dBm and data rates up to 2 Mbps. It has the option to scan and advertise simultaneously, as well as supporting multiple connections in peripheral/central mode.7 System7.1 ResetsThe ESP32-S3 has support for four levels of reset:CPU: resets CPU0/CPU1 coreCore: resets the digital system, except for the RTC peripherals (ULP coprocessor, RTC memory).System: resets the entire digital system, including the RTC peripherals.Chip: resets the entire chip.It is possible to conduct a software reset of this board, as well as obtaining the reset reason.To do a hardware reset of the board, use the onboard reset button (PB1).7.2 TimersThe Nano ESP32 has the following timers:52-bit system timer with 2x 52-bit counters (16 MHz) and 3x comparators.4x general-purpose 54-bit timers3x watchdog timers, two in main system (MWDT0/1), one in the RTC module (RWDT).7.3 InterruptsAll GPIOs on the Nano ESP32 can be configured to be used as interrupts, and is provided by an interrupt matrix. Interrupt pins are configured on an application level, using the following configurations:LOWHIGHCHANGEFALLINGRISING8 Serial Communication ProtocolsThe ESP32-S3 chip provides flexibility for the various serial protocols it supports. For example, the I2C bus can be assigned to almost any available GPIO.8.1 Inter-Integrated Circuit (I2C)Default pins:A4 - SDAA5 - SCLThe I2C bus is by default assigned to the A4/A5 (SDA/SCL) pins for retro compatibility. This pin assignment can however be changed, due to the flexibility of the ESP32-S3 chip.The SDA and SCL pins can be assigned to most GPIOs, however some of these pins may have other essential functions that prevents I2C operations to run successfully.Please note: many software libraries uses the standard pin assignment (A4/A5).8.2 Inter-IC Sound (I2S)There two I2S controllers that are typically used for communication with audio devices. There are no specific pins assigned for I2S, this can be used by any free GPIO.Using standard or TDM mode, the following lines are used:MCLK - master clockBCLK - bit clockWS - word selectDIN/DOUT - serial dataUsing PDM mode:CLK - PDM clockDIN/DOUT serial dataRead more about the I2S protocol in Espressif's Peripheral API - InterIC Sounds (I2S)8.3 Serial Peripheral Interface (SPI)SCK - D13COPI - D12CIPO - D11CS - D10The SPI controller is by default assigned to the pins above.8.4 Universal Asynchronous Receiver/Transmitter (UART)D0 / TXD1 / RXThe UART controller is by default assigned to the the pins above.8.5 Two Wire Automotive Interface (TWAI®)The CAN/TWAI® controller is used to communicate with systems using the CAN/TWAI® protocol, particularly common in the automotive industry. There are no specific pins assigned for the CAN/TWAI® controller, any free GPIO can be used.Please note: TWAI® is also known as the CAN2.0B, or "CAN classic". The CAN controller is NOT compatible with CAN FD frames.9 External Flash MemoryNano ESP32 features a 128 Mbit (16 MB) external flash, the GD25B128EWIGR (U3). This memory is connected to the ESP32 via Quad Serial Peripheral Interface (QSPI).The operating frequency for this IC is 133 MHz, and has a data transfer rate at up to 664 Mbit/s.10 USB ConnectorThe Nano ESP32 has one USB-C® port, used to power and program your board as well as sending & receiving serial communication.Note that you should not power the board with more than 5 V via the USB-C® port.11 Power OptionsPower can either be supplied via the VIN pin, or via USB-C® connector. Any voltage input either via USB or VIN is stepped down to 3.3 V using the MP2322GQH (U2) converter.The operating voltage for this board is 3.3 V. Please note that there's no 5V pin available on this board, only the VBUS can provide 5 V when the board is powered via USB.11.1 Power TreeArduino Nano ESP32 power tree.11.2 Pin VoltageAll digital & analog pins on the Nano ESP32 are 3.3 V. Do not connect any higher voltage devices to any of the pins as it will risk damaging the board.11.3 VIN RatingThe recommended input voltage range is 6-21 V.You should not attempt to power the board with a voltage outside the recommended range, particularly not higher than 21 V.The efficiency of the converter depends on the input voltage via the VIN pin. See the average below for a board operation with normal current consumption:4.5 V - >90%.12 V - 85-90%18 V - <85%This information is extracted from the MP2322GQH's datasheet.11.4 VUSBThere is no 5V pin available on the Nano ESP32. 5 V can only be provided via the VUSB, which is supplied directly from the USB-C® power source.While powering the board via the VIN pin, the VUSB pin is not activated. This means you have no option of providing 5 V from the board unless powered via USB or externally.11.5 Using the 3.3 V PinThe 3.3 V pin is connected to the 3.3 V rail which is connected to the output of the MP2322GQH step down converter. This pin is primarily used to power external components.11.6 Pin CurrentThe GPIOs on the Nano ESP32 can handle source currents up to 40 mA, and sink currents up to 28 mA. Never connect devices that draw higher current directly to a GPIO.Mechanical Information12 PinoutPinout for Nano ESP32.12.1 Analog (JP1)Pin Function Type Description1SCK NC Serial Clock2+3V3Power+3V3 Power Rail3BOOT0Mode Board Reset 04A0Analog Analog input 05A1Analog Analog input 16A2Analog Analog input 27A3Analog Analog input 38A4Analog Analog input 4 / I²C Serial Datal (SDA) 9A5Analog Analog input 5 / I²C Serial Clock (SCL) 10A6Analog Analog input 611A7Analog Analog input 712VUSB Power USB power (5V)13BOOT1Mode Board Reset 114GND Power Ground15VIN Power Voltage Input12.2 Digital (JP2)Pin Function Type Description1D12 / CIPO*Digital Controller In Peripheral Out2D11 / COPI*Digital Controller Out Peripheral In3D10Digital Chip Select4D9Digital GPIO 95D8Digital GPIO 86D7Digital GPIO 77D6Digital GPIO 68D5Digital GPIO 59D4Digital GPIO 410D3Digital GPIO 311D2Digital GPIO 212GND Power Ground13RST Internal Reset14D1/RX Digital GPIO 4 / Serial 0 Receiver (RX) 15D0/TX Digital GPIO 3 / Serial 0 Transmitter (TX) *CIPO/COPI replaces the MISO/MOSI terminology.13 Mounting Holes And Board OutlineMechanical View of Nano ESP3214 Board Operation14.1 Getting Started - IDEIf you want to program your Nano ESP32 while offline you need to install the Arduino IDE [1]. To connect the Nano ESP32 to your computer, you will need a Type-C® USB cable, which can also provide power to the board, as indicated by the LED (DL1).14.2 Getting Started - Arduino Web EditorAll Arduino boards, including this one, work out-of-the-box on the Arduino Web Editor [2], by just installing a simple plugin.The Arduino Web Editor is hosted online, therefore it will always be up-to-date with the latest features and support for all boards. Follow [3] to start coding on the browser and upload your sketches onto your board.14.3 Getting Started - Arduino IoT CloudAll Arduino IoT enabled products are supported on Arduino IoT Cloud which allows you to log, graph and analyze sensor data, trigger events, and automate your home or business.14.4 Online ResourcesNow that you have gone through the basics of what you can do with the board you can explore the endless possibilities it provides by checking exciting projects on Arduino Project Hub [4], the Arduino Library Reference [5], and the online store [6]; where you will be able to complement your board with sensors, actuators and more. 14.5 Board RecoveryAll Arduino boards have a built-in bootloader which allows flashing the board via USB. In case a sketch locks up the processor and the board is not reachable anymore via USB, it is possible to enter bootloader mode by double-tapping the reset button right after the power-up.Certifications15 Declaration of Conformity CE DoC (EU)We declare under our sole responsibility that the products above are in conformity with the essential requirements of the following EU Directives and therefore qualify for free movement within markets comprising the European Union (EU) and European Economic Area (EEA).16 Declaration of Conformity to EU RoHS & REACH 21101/19/2021Arduino boards are in compliance with RoHS 2 Directive 2011/65/EU of the European Parliament and RoHS 3 Directive 2015/863/EU of the Council of 4 June 2015 on the restriction of the use of certain hazardous substances in electrical and electronic equipment.Substance Maximum Limit (ppm)Lead (Pb)1000Cadmium (Cd)100Mercury (Hg)1000Hexavalent Chromium (Cr6+)1000Poly Brominated Biphenyls (PBB)1000Poly Brominated Diphenyl ethers (PBDE)1000Bis(2-Ethylhexyl} phthalate (DEHP)1000Benzyl butyl phthalate (BBP)1000Dibutyl phthalate (DBP)1000Diisobutyl phthalate (DIBP)1000Exemptions : No exemptions are claimed.Arduino Boards are fully compliant with the related requirements of European Union Regulation (EC) 1907 /2006 concerning the Registration, Evaluation, Authorization and Restriction of Chemicals (REACH). We declare none of the SVHCs (https://echa.europa.eu/web/guest/candidate-list-table), the Candidate List of Substances of Very High Concern for authorization currently released by ECHA, is present in all products (and also package) in quantities totaling in a concentration equal or above 0.1%. To the best of our knowledge, we also declare that our products do not contain any of the substances listed on the "Authorization List" (Annex XIV of the REACH regulations) and Substances of Very High Concern (SVHC) in any significant amounts as specified by the Annex XVII of Candidate list published by ECHA (European Chemical Agency) 1907 /2006/EC.17 Conflict Minerals DeclarationAs a global supplier of electronic and electrical components, Arduino is aware of our obligations with regards to laws and regulations regarding Conflict Minerals, specifically the Dodd-Frank Wall Street Reform and Consumer Protection Act, Section 1502. Arduino does not directly source or process conflict minerals such as Tin, Tantalum, Tungsten, or Gold. Conflict minerals are contained in our products in the form of solder, or as a component in metal alloys. As part of our reasonable due diligence Arduino has contacted component suppliers within our supply chain to verify their continued compliance with the regulations. Based on the information received thus far we declare that our products contain Conflict Minerals sourced from conflict-free areas.18 FCC CautionAny Changes or modifications not expressly approved by the party responsible for compliance could void the user’s authority to operate the equipment.This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions:(1) This device may not cause harmful interference(2) this device must accept any interference received, including interference that may cause undesired operation. FCC RF Radiation Exposure Statement:1. This Transmitter must not be co-located or operating in conjunction with any other antenna or transmitter.2. This equipment complies with RF radiation exposure limits set forth for an uncontrolled environment.3. This equipment should be installed and operated with a minimum distance of 20 cm between the radiator &your body.English: User manuals for licence-exempt radio apparatus shall contain the following or equivalent notice in a conspicuous location in the user manual or alternatively on the device or both. This device complies with Industry Canada licence-exempt RSS standard(s). Operation is subject to the following two conditions:(1) this device may not cause interference(2) this device must accept any interference, including interference that may cause undesired operation of the device.French: Le présent appareil est conforme aux CNR d’Industrie Canada applicables aux appareils radio exempts de licence. L’exploitation est autorisée aux deux conditions suivantes :(1) l’ appareil nedoit pas produire de brouillage(2) l’utilisateur de l’appareil doit accepter tout brouillage radioélectrique subi, même si le brouillage est susceptible d’en compromettre le fonctionnement.IC SAR Warning:English This equipment should be installed and operated with a minimum distance of 20 cm between the radiator and your body.French: Lors de l’ installation et de l’ exploitation de ce dispositif, la distance entre le radiateur et le corps est d ’au moins 20 cm.Important: The operating temperature of the EUT can’t exceed 85℃ and shouldn’t be lower than -40 ℃. Hereby, Arduino S.r.l. declares that this product is in compliance with essential requirements and other relevant provisions of Directive 201453/EU. This product is allowed to be used in all EU member states.19 Company InformationCompany name Arduino SRLCompany Address Via Andrea Appiani, 25 - 20900 MONZA Italy)20 Reference DocumentationRef LinkArduino IDE (Desktop)https:///en/Main/SoftwareArduino Web Editor(Cloud)https:///editorWeb Editor - Getting Started https:///cloud/web-editor/tutorials/getting-started/getting-started-web-editorProject Hub https:///projecthub?by=part&part_id=11332&sort=trending Library Reference https:///arduino-libraries/Online Store https:///21 Change LogDate Changes08/06/2023Release。
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()函数会被调用。
Product Reference ManualSKU: A000066DescriptionThe Arduino UNO R3 is the perfect board to get familiar with electronics and coding. This versatile microcontroller is equipped with the well-known ATmega328P and the ATMega 16U2 Processor.This board will give you a great first experience within the world of Arduino.Target areas:Maker, introduction, industriesFeaturesATMega328P ProcessorMemoryAVR CPU at up to 16 MHz32KB Flash2KB SRAM1KB EEPROMSecurityPower On Reset (POR)Brown Out Detection (BOD)Peripherals2x 8-bit Timer/Counter with a dedicated period register and compare channels1x 16-bit Timer/Counter with a dedicated period register, input capture and compare channels1x USART with fractional baud rate generator and start-of-frame detection1x controller/peripheral Serial Peripheral Interface (SPI)1x Dual mode controller/peripheral I2C1x Analog Comparator (AC) with a scalable reference inputWatchdog Timer with separate on-chip oscillatorSix PWM channelsInterrupt and wake-up on pin changeATMega16U2 Processor8-bit AVR® RISC-based microcontrollerMemory16 KB ISP Flash512B EEPROM512B SRAMdebugWIRE interface for on-chip debugging and programmingPower2.7-5.5 volts444445556677777789910101111111212131313CONTENTS1 The Board1.1 Application Examples 1.2 Related Products 2 Ratings2.1 Recommended Operating Conditions 2.2 Power Consumption 3 Functional Overview3.1 Board Topology 3.2 Processor 3.3 Power Tree 4 Board Operation4.1 Getting Started - IDE4.2 Getting Started - Arduino Web Editor 4.3 Getting Started - Arduino IoT Cloud 4.4 Sample Sketches 4.5 Online Resources 5 Connector Pinouts5.1 JANALOG 5.2 JDIGITAL5.3 Mechanical Information5.4 Board Outline & Mounting Holes 6 Certifications6.1 Declaration of Conformity CE DoC (EU)6.2 Declaration of Conformity to EU RoHS & REACH 211 01/19/20216.3 Conflict Minerals Declaration 7 FCC Caution8 Company Information 9 Reference Documentation 10 Revision History1 The Board1.1 Application ExamplesThe UNO board is the flagship product of Arduino. Regardless if you are new to the world of electronics or will use the UNO as a tool for education purposes or industry-related tasks.First entry to electronics: If this is your first project within coding and electronics, get started with our most used and documented board; Arduino UNO. It is equipped with the well-known ATmega328P processor, 14 digital input/output pins, 6 analog inputs, USB connections, ICSP header and reset button. This board includes everything you will need for a great first experience with Arduino.Industry-standard development board: Using the Arduino UNO board in industries, there are a range of companies using the UNO board as the brain for their PLC’s.Education purposes: Although the UNO board has been with us for about ten years, it is still widely used for various education purposes and scientific projects. The board's high standard and top quality performance makes it a great resource to capture real time from sensors and to trigger complex laboratory equipment to mention a few examples.1.2 Related ProductsStarter KitTinkerkit Braccio RobotExample2 Ratings2.1 Recommended Operating ConditionsSymbol Description Min Max Conservative thermal limits for the whole board:-40 °C (-40°F)85 °C ( 185°F) NOTE: In extreme temperatures, EEPROM, voltage regulator, and the crystal oscillator, might notwork as expected due to the extreme temperature conditions2.2 Power ConsumptionSymbol Description Min Typ Max Unit VINMax Maximum input voltage from VIN pad6-20V VUSBMax Maximum input voltage from USB connector- 5.5V PMax Maximum Power Consumption--xx mA 3 Functional Overview3.1 Board TopologyTop viewBoard topologyRef.Description Ref.DescriptionX1Power jack 2.1x5.5mm U1SPX1117M3-L-5 RegulatorX2USB B Connector U3ATMEGA16U2 ModulePC1EEE-1EA470WP 25V SMD Capacitor U5LMV358LIST-A.9 ICPC2EEE-1EA470WP 25V SMD Capacitor F1Chip Capacitor, High DensityD1CGRA4007-G Rectifier ICSP Pin header connector (through hole 6)J-ZU4ATMEGA328P Module ICSP1Pin header connector (through hole 6)Y1ECS-160-20-4X-DU Oscillator3.2 ProcessorThe Main Processor is a ATmega328P running at up tp 20 MHz. Most of its pins are connected to the external headers, however some are reserved for internal communication with the USB Bridge coprocessor.3.3 Power TreePower tree4 Board Operation4.1 Getting Started - IDEIf you want to program your Arduino UNO while offline you need to install the Arduino Desktop IDE [1] To connect the Arduino UNO to your computer, you’ll need a Micro-B USB cable. This also provides power to the board, as indicated by the LED.4.2 Getting Started - Arduino Web EditorAll Arduino boards, including this one, work out-of-the-box on the Arduino Web Editor [2], by just installing a simple plugin.The Arduino Web Editor is hosted online, therefore it will always be up-to-date with the latest features and support for all boards. Follow [3] to start coding on the browser and upload your sketches onto your board.4.3 Getting Started - Arduino IoT CloudAll Arduino IoT enabled products are supported on Arduino IoT Cloud which allows you to Log, graph and analyze sensor data, trigger events, and automate your home or business.4.4 Sample SketchesSample sketches for the Arduino XXX can be found either in the “Examples” menu in the Arduino IDE or in the “Documentation” section of the Arduino Pro website [4]4.5 Online ResourcesNow that you have gone through the basics of what you can do with the board you can explore the endless possibilities it provides by checking exciting projects on ProjectHub [5], the Arduino Library Reference [6] and the online store [7] where you will be able to complement your board with sensors, actuators and more5 Connector PinoutsPinout5.1 JANALOGPin Function Type Description1NC NC Not connected2IOREF IOREF Reference for digital logic V - connected to 5V 3Reset Reset Reset4+3V3Power+3V3 Power Rail5+5V Power+5V Power Rail6GND Power Ground7GND Power Ground8VIN Power Voltage Input9A0Analog/GPIO Analog input 0 /GPIO10A1Analog/GPIO Analog input 1 /GPIO11A2Analog/GPIO Analog input 2 /GPIO12A3Analog/GPIO Analog input 3 /GPIO13A4/SDA Analog input/I2C Analog input 4/I2C Data line14A5/SCL Analog input/I2C Analog input 5/I2C Clock line5.2 JDIGITALPin Function Type Description1D0Digital/GPIO Digital pin 0/GPIO2D1Digital/GPIO Digital pin 1/GPIO3D2Digital/GPIO Digital pin 2/GPIO4D3Digital/GPIO Digital pin 3/GPIO5D4Digital/GPIO Digital pin 4/GPIO6D5Digital/GPIO Digital pin 5/GPIO7D6Digital/GPIO Digital pin 6/GPIO8D7Digital/GPIO Digital pin 7/GPIO9D8Digital/GPIO Digital pin 8/GPIO10D9Digital/GPIO Digital pin 9/GPIO11SS Digital SPI Chip Select12MOSI Digital SPI1 Main Out Secondary In13MISO Digital SPI Main In Secondary Out14SCK Digital SPI serial clock output15GND Power Ground16AREF Digital Analog reference voltage17A4/SD4Digital Analog input 4/I2C Data line (duplicated)18A5/SD5Digital Analog input 5/I2C Clock line (duplicated)5.3 Mechanical Information5.4 Board Outline & Mounting HolesBoard outline6 Certifications6.1 Declaration of Conformity CE DoC (EU)We declare under our sole responsibility that the products above are in conformity with the essential requirements of the following EU Directives and therefore qualify for free movement within markets comprising the European Union (EU) and European Economic Area (EEA).ROHS 2 Directive 2011/65/EUConforms to:EN50581:2012Directive 2014/35/EU. (LVD)Conforms to:EN 60950-1:2006/A11:2009/A1:2010/A12:2011/AC:2011 Directive 2004/40/EC & 2008/46/EC & 2013/35/EU,EMFConforms to:EN 62311:20086.2 Declaration of Conformity to EU RoHS & REACH 211 01/19/2021Arduino boards are in compliance with RoHS 2 Directive 2011/65/EU of the European Parliament and RoHS 3 Directive 2015/863/EU of the Council of 4 June 2015 on the restriction of the use of certain hazardous substances in electrical and electronic equipment.Substance Maximum limit (ppm)Lead (Pb)1000Cadmium (Cd)100Mercury (Hg)1000Hexavalent Chromium (Cr6+)1000Poly Brominated Biphenyls (PBB)1000Poly Brominated Diphenyl ethers (PBDE)1000Bis(2-Ethylhexyl} phthalate (DEHP)1000Benzyl butyl phthalate (BBP)1000Dibutyl phthalate (DBP)1000Diisobutyl phthalate (DIBP)1000Exemptions: No exemptions are claimed.Arduino Boards are fully compliant with the related requirements of European Union Regulation (EC) 1907 /2006 concerning the Registration, Evaluation, Authorization and Restriction of Chemicals (REACH). We declare none of the SVHCs (https://echa.europa.eu/web/guest/candidate-list-table), the Candidate List of Substances of Very High Concern for authorization currently released by ECHA, is present in all products (and also package) in quantities totaling in a concentration equal or above 0.1%. To the best of our knowledge, we also declare that our products do not contain any of the substances listed on the "Authorization List" (Annex XIV of the REACH regulations) and Substances of Very High Concern (SVHC) in any significant amounts as specified by the Annex XVII of Candidate list published by ECHA (European Chemical Agency) 1907 /2006/EC.6.3 Conflict Minerals DeclarationAs a global supplier of electronic and electrical components, Arduino is aware of our obligations with regards to laws and regulations regarding Conflict Minerals, specifically the Dodd-Frank Wall Street Reform and Consumer Protection Act, Section 1502. Arduino does not directly source or process conflict minerals such as Tin, Tantalum, Tungsten, or Gold. Conflict minerals are contained in our products in the form of solder, or as a component in metal alloys. As part of our reasonable due diligence Arduino has contacted component suppliers within our supply chain to verify their continued compliance with the regulations. Based on the information received thus far we declare that our products contain Conflict Minerals sourced from conflict-free areas.7 FCC CautionAny Changes or modifications not expressly approved by the party responsible for compliance could void the user’s authority to operate the equipment.This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions:(1) This device may not cause harmful interference(2) this device must accept any interference received, including interference that may cause undesired operation. FCC RF Radiation Exposure Statement:1. This Transmitter must not be co-located or operating in conjunction with any other antenna or transmitter.2. This equipment complies with RF radiation exposure limits set forth for an uncontrolled environment.3. This equipment should be installed and operated with minimum distance 20cm between the radiator &your body.English: User manuals for license-exempt radio apparatus shall contain the following or equivalent notice in a conspicuous location in the user manual or alternatively on the device or both. This device complies with Industry Canada license-exempt RSS standard(s). Operation is subject to the following two conditions:(1) this device may not cause interference(2) this device must accept any interference, including interference that may cause undesired operation of the device.French: Le présent appareil est conforme aux CNR d’Industrie Canada applicables aux appareils radio exempts de licence. L’exploitation est autorisée aux deux conditions suivantes :(1) l’ appareil nedoit pas produire de brouillage(2) l’utilisateur de l’appareil doit accepter tout brouillage radioélectrique subi, même si le brouillage est susceptible d’en compromettre le fonctionnement.IC SAR Warning:English This equipment should be installed and operated with minimum distance 20 cm between the radiator and your body.French: Lors de l’ installation et de l’ exploitation de ce dispositif, la distance entre le radiateur et le corps est d ’au moins 20 cm.Important: The operating temperature of the EUT can’t exceed 85℃ and shouldn’t be lower than -40℃. Hereby, Arduino S.r.l. declares that this product is in compliance with essential requirements and other relevant provisions of Directive 2014/53/EU. This product is allowed to be used in all EU member states.8 Company InformationCompany name Arduino S.r.lCompany Address Via Andrea Appiani 25 20900 MONZA Italy9 Reference DocumentationReference LinkArduino IDE(Desktop)https:///en/Main/SoftwareArduino IDE (Cloud)https:///editorCloud IDE Getting Started https:///projecthub/Arduino_Genuino/getting-started-with-arduino-web-editor-4b3e4aArduino Pro Website https:///proProject Hub https:///projecthub?by=part&part_id=11332&sort=trending Library Reference https:///reference/en/Online Store https:///10 Revision HistoryDate Revision Changesxx/06/20211Datasheet release。
Arduino语法手册Arduino的程序可以划分为三个主要部分:结构、变量(变量与常量)、函数。
结构部分一、结构1.1setup()1.2loop()二、结构控制2.1if2.2if...else2.3for2.4switchcase2.5while2.6do...while2.7break2.8continue2.9return2.10goto三、扩展语法3.1;(分号)3.2{}(花括号)3.3//(单行注释)3.4/**/(多行注释)3.5#define3.6#include四、算数运算符4.1=(赋值运算符)4.2+(加)4.3-(减)4.4*(乘)4.5/(除)4.6%(模)五、比较运算符5.1==(等于)5.2!=(不等于)5.3<(小于)5.4>(大于)5.5<=(小于等于)5.6>=(大于等于)六、布尔运算符6.1&&(与)6.2||(或)6.3!(非)七、指针运算符7.1*取消引用运算符7.2&引用运算符八、位运算符8.1&(bitwiseand)8.2|(bitwiseor)8.3^(bitwisexor)8.4~(bitwisenot)8.5<<(bitshiftleft)8.6>>(bitshiftright)九、复合运算符9.1++(increment)9.2--(decrement)9.3+=(compoundaddition)9.4-=(compoundsubtraction)9.5*=(compoundmultiplication)9.6/=(compounddivision)9.6&=(compoundbitwiseand)9.8|=(compoundbitwiseor)变量部分十、常量10.1HIGH|LOW(引脚电压定义)10.2INPUT|OUTPUT(数字引脚(Digitalpins)定义)10.3true|false(逻辑层定义)10.4integerconstants(整数常量)10.5floatingpointconstants(浮点常量)十一、数据类型11.1void11.2boolean(布尔)11.3char(有号数据类型)11.4unsignedchar(无符号数据类型)11.5byte(无符号数)11.6int(整型)11.7unsignedint(无符号整型)11.8word11.9long(长整数型)11.10unsignedlong(无符号长整数型)11.11float(浮点型数)11.12double(双精度浮点数)11.13string(chararray/字符串)11.14Stringobject(String类)11.15array(数组)十二、数据类型转换12.1char()12.2byte()12.3int()12.4word()12.5long()12.6float()十三、变量作用域&修饰符13.1variablescope(变量的作用域)13.2static(静态变量)13.3volatile13.4const十四、辅助工具14.1sizeof()函数部分十五、数字I/O15.1pinMode()15.2digitalWrite()15.3digitalRead()十六、模拟I/O16.1analogReference()16.2analogRead()16.3analogWrite()PWM十七、高级I/O17.1tone()17.2noTone()17.3shiftOut()17.4shiftIn()17.5pulseIn()十八、时间18.1millis()18.2micros()18.3delay()18.4delayMicroseconds() 十九、数学运算19.1min()19.2max()19.3abs()19.4constrain()19.5map()19.6pow()19.7sqrt()19.8ceil()19.9exp()19.10fabs()19.11floor()19.12fma()19.13fmax()19.14fmin()19.15fmod()19.16ldexp()19.17log()19.18log10()19.19round()19.20signbit()19.21sq()19.22square()19.23trunc()二十、三角函数20.1sin()20.2cos()20.3tan()20.4acos()20.5asin()20.6atan()20.7atan2()20.8cosh()20.9degrees()20.10hypot()20.11radians()20.12sinh()20.13tanh()二十一、随机数21.1randomSeed()21.2random()二十二、位操作22.1lowByte()22.2highByte()22.3bitRead()22.4bitWrite()22.5bitSet()22.6bitClear()22.7bit()二十三、设置中断函数23.1attachInterrupt()23.2detachInterrupt()二十四、开关中断24.1interrupts()(中断)24.2noInterrupts()(禁止中断)二十五、通讯25.1Serial25.2Stream二十六、USB(仅适用于Leonardo和Due)26.1Mouse(键盘)26.2Keyboard(鼠标)结构部分一、结构1.1setup()在Arduino中程序运行时将首先调用setup()函数。
宏定义 (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的程序可以划分为三个主要部分:结构、变量(变量与常量)、函数。
结构部分一、结构1.1setup()1.2loop()二、结构控制2.1if2.2if...else2.3for2.4switchcase2.5while2.6do...while2.7break2.8continue2.9return2.10goto三、扩展语法3.1;(分号)3.2{}(花括号)3.3//(单行注释)3.4/RR/(多行注释)3.5#define3.6#include四、算数运算符4.1=(赋值运算符)4.2+(加)4.3-(减)4.4R(乘)4.5/(除)4.6%(模)五、比较运算符5.1==(等于)5.2!=(不等于)5.3<(小于)5.4>(大于)5.5<=(小于等于)5.6>=(大于等于)六、布尔运算符6.1&&(与)6.2||(或)6.3!(非)七、指针运算符7.1R取消引用运算符7.2&引用运算符八、位运算符8.1&(bitwiseand)8.2|(bitwiseor)8.3^(bitwiseRor)8.4~(bitwisenot)8.5<<(bitshiftleft)8.6>>(bitshiftright)九、复合运算符9.1++(increment)9.2--(decrement)9.3+=(compoundaddition)9.4-=(compoundsubtraction)9.5R=(compoundmultiplication)9.6/=(compounddivision)9.6&=(compoundbitwiseand)9.8|=(compoundbitwiseor)变量部分十、常量10.1HIGH|LOW(引脚电压定义)10.2INPUT|OUTPUT(数字引脚(Digitalpins)定义)10.3true|false(逻辑层定义)10.4integerconstants(整数常量)10.5floatingpointconstants(浮点常量)十一、数据类型11.1void11.2boolean(布尔)11.3char(有号数据类型)11.4unsignedchar(无符号数据类型)11.5bRte(无符号数)11.6int(整型)11.7unsignedint(无符号整型)11.8word11.9long(长整数型)11.10unsignedlong(无符号长整数型)11.11float(浮点型数)11.12double(双精度浮点数)11.13string(chararraR/字符串)11.14Stringobject(String类)11.15arraR(数组)十二、数据类型转换12.1char()12.2bRte()12.3int()12.4word()12.5long()12.6float()十三、变量作用域&修饰符13.1variablescope(变量的作用域)13.2static(静态变量)13.3volatile13.4const十四、辅助工具14.1sizeof()函数部分十R五、数字I/O15.1pinMode()15.2digitalWrite()15.3digitalRead()十六、模拟I/O16.1analogReference()16.2analogRead()16.3analogWrite()PWM 十七、高级I/O17.1tone()17.2noTone()17.3shiftOut()17.4shiftIn()17.5pulseIn()十八、时间18.1millis()18.2micros()18.3delaR()18.4delaRMicroseconds() 十九、数学运算19.1min()19.2maR()19.3abs()19.4constrain()19.5map()19.6pow()19.7sqrt()19.8ceil()19.9eRp()19.10fabs()19.11floor()19.12fma()19.13fmaR()19.14fmin()19.15fmod()19.16ldeRp()19.17log()19.18log10()19.19round()19.20signbit()19.21sq()19.22square()19.23trunc()二十、三角函数20.1sin()20.2cos()20.3tan()20.4acos()20.5asin()20.6atan()20.7atan2()20.8cosh()20.9degrees()20.10hRpot()20.11radians()20.12sinh()20.13tanh()二十一、随机数21.1randomSeed()21.2random()二十二、位操作22.1lowBRte()22.2highBRte()22.3bitRead()22.4bitWrite()22.5bitSet()22.6bitClear()22.7bit()二十三、设置中断函数23.1attachInterrupt()23.2detachInterrupt()二十四、开关中断24.1interrupts()(中断)24.2noInterrupts()(禁止中断)二十R五、通讯25.1Serial25.1.1if(Serial)25.1.2Serial.available()25.1.3Serial.begin()25.1.4Serial.end()25.1.5Serial.find()25.1.6Serial.findUntil()25.1.7Serial.flush()25.1.8Serial.parseFloat()25.1.9Serial.parseInt()25.1.10Serial.peek()25.1.11Serial.print()25.1.12Serial.println()25.1.13Serial.read()25.1.14Serial.readBRtes()25.1.15Serial.readBRtesUntil()25.1.16Serial.setTimeout()25.1.17Serial.write()25.1.18Serial.SerialEvent()25.2Stream二十六、USB(仅适用于Leonardo和Due)26.1Mouse(键盘)26.2KeRboard(鼠标)结构部分一、结构1.1setup()在Arduino中程序运行时将首先调用setup()函数。
Arduino参考手册Arduino开发语言提供全部的C语言特性和C++语言的部分特性. 通过链接到AVR的libc库online~, 可以使用库中提供的函数. 具体的应用细节请参考相关文档.程序结构在Arduino中, 标准的程序入口main函数在内部被定义, 用户只需要关心以下两个函数: ∙void setup()∙void loop()setup()函数用于初始化, loop()函数用于执行. 初始化函数一般放在程序开头, 用于设置一些引脚的输出/输入模式, 初始化串口通讯等类似工作. loop()函数中的代码将被循环执行, 例如: 读入引脚状态, 设置引脚输出状态等.控制语句∙if∙if...else∙for∙switch∙while∙do...while∙break∙continue∙return∙goto相关语法∙; (分号)∙{}(大括号)∙// (单行注释)∙/* * / (多行注释)∙#define∙#include算术运算符∙= (赋值)∙+ (加)∙- (减)∙* (乘)∙/ (除)∙% (取模)比较运算符∙== (等于)∙!= (不等于)∙< (小于)∙> (大于)∙<= (小于等于)∙>= (大于等于)布尔运算符∙&& (逻辑与)∙|| (逻辑或)∙! (逻辑非)指针运算符∙* 指针运算符∙& 地址运算符位运算∙& (位与)∙| (位或)∙^ (位异或)∙~ (位非)∙<< (左移)∙>> (右移)∙端口操作复合运算符∙++ (自加)∙-- (自减)∙+= (复合加)∙-= (复合减)∙*= (复合乘)∙/= (复合除)∙&= (复合与)∙|= (复合或)变量常量∙HIGH | LOW∙INPUT | OUTPUT∙true | false∙整数常量∙浮点数常量数据类型∙void(无类型)∙boolean(布尔型)∙char(字符型)∙unsigned char(无符号字符型)∙byte(字节型)∙int(整型)∙unsigned int(无符号整型)∙long(长整型)∙unsigned long(无符号长整型)∙float(单精度)∙double(双精度)∙string(字符串)∙array(数组)数据类型转换∙char()∙byte()∙int()∙word()∙long()∙float()变量作用域&修饰符∙变量作用域∙static (静态变量)∙volatile (易变变量)∙const (不可改变变量)辅助工具∙sizeof() (sizeof运算符)∙ASCII码表基本函数数字I/O∙pinMode(pin, mode)∙digitalWrite(pin, value)∙digitalRead(pin)模拟I/O∙analogReference(type)∙analogRead(pin)∙analogWrite(pin, value) - PWM高级I/O∙shiftOut(dataPin, clockPin, bitOrder, val)∙pulseIn(pin, state, timeout)时间∙millis()∙delay(ms)∙delayMicroseconds(us)数学库∙min(x, y)∙max(x, y)∙abs(x)∙constrain(x, a, b)∙map(x, in_min, in_max, out_min, out_max)∙pow(base, exponent)∙sqrt(x)三角函数∙sin(rad)∙cos(rad)∙tan(rad)随机数∙randomSeed(seed)∙random(howbig)∙random(howsmall, howbig)位操作∙lowByte()∙highByte()∙bitRead()∙bitWrite()∙bitSet()∙bitClear()∙bit()设置中断函数∙attachInterrupt(interrupt, function, mode)∙detachInterrupt(interrupt)开关中断∙interrupts()∙noInterrupts()串口通讯∙Serial.begin(speed)∙Serial.available()∙Serial.read()∙Serial.flush()∙Serial.print(data)∙Serial.println(data)扩展库如果要使用一些已有的库, 可以选择菜单"Sketch->Import Library", 然后选择相应的库. Sketch工具会自己在代码的开头包含库的头文件(#include).在引入库之后, 程序的体积也将会增大(因为包含了库的代码). 对于不是必要的库, 直接删除对应的#include语句就可以了.官方扩展库以下是Arduino官方提供的扩展库, 被默认包含在开发工具中.∙EEPROM - 读写EEPROM存储区.∙Ethernet - 以太网支持.∙Firmata - 基于串口的通讯协议.∙LiquidCrystal - LCD液晶显示.∙Servo - 伺服电机.∙SoftwareSerial - 软件实现的串口, 可以选择任意引脚.∙Stepper - 步进电机.∙Wire - I2C协议支持.∙Matrix - LED显示阵列控制.∙Sprite - LED显示阵列中子块控制.第三方扩展库这里只包含了Roboduino扩展板的相关库, 其他的库信息请访问: Arduino在线文档online~.Roboduino扩展板:∙RoboduinoMotor - Roboduino电机扩展板驱动.如果需要设计自己的库, 请参考"arduino\hardware\libraries"目录中相关库的代码.====================================================================== ======================================================================Arduino语言注解wxxmickey 发表于- 2008-11-23 18:59:00Arduino语言是建立在C/C++基础上的,其实也就是基础的C语言,Arduino语言只不过把AVR单片机(微控制器)相关的一些参数设置都函数化,不用我们去了解他的底层,让我们不了解A VR单片机(微控制器)的朋友也能轻松上手。