核心职能
Simple programs that demonstrate basic Arduino commands.简单的程序,演示基本的Arduino命令。 These are included with the Arduino environment; to open them, click the Open button on the toolbar and look in the examples folder.这些都包含在Arduino环境,打开它们,单击工具栏上的打开按钮,并期待在examples文件夹。
1.Basics 1.Basics
BareMinimum : The bare minimum of code needed to start an Arduino sketch. BareMinimum :最低限度的代码需要启动一个Arduino草图。
Blink : Turn an LED on and off. 闪烁 :开启LED的开启和关闭。
DigitalReadSerial : Read a switch, print the state out to the Arduino Serial Monitor. DigitalReadSerial :阅读交换机,打印到Arduino串行监视器的状态。
AnalogReadSerial : Read a potentiometer, print it's state out to the Arduino Serial Monitor. AnalogReadSerial :阅读电位器,打印到Arduino串行监视器,它的状态。
Fade : Demonstrates the use of analog output to fade an LED. :演示使用模拟输出褪的LED
2.Digital 2.Digital
Blink Without Delay : blinking an LED without using the delay() function. 毫不拖延地闪烁 :闪烁的LED不使用延迟()函数。
Button : use a pushbutton to control an LED. 按钮 :使用一个按钮来控制一个LED
Debounce : read a pushbutton, filtering noise. 防抖动 :读一个按钮,过滤噪声。
Button State Change : counting the number of button pushes. 按钮状态的变化 :计数按钮推。
Tone : play a melody with a Piezo speaker. :用压电扬声器播放的旋律。
Pitch follower : play a pitch on a piezo speaker depending on an analog input. 间距追随者 :发挥取决于模拟输入压电扬声器的音调。
Simple Keyboard : a three-key musical keyboard using force sensors and a piezo speaker. 简单的键盘 :三键的音乐键盘,使用武力传感器和压电扬声器。
Tone4 : play tones on multiple speakers sequentially using the tone() command. tone4 :顺序播放多个扬声器的音音()命令。
3.Analog 3.Analog
AnalogInOutSerial : read an analog input pin, map the result, and then use that data to dim or brighten an LED. AnalogInOutSerial :读取模拟输入引脚,图的结果,然后用这些数据来变暗或变亮的LED
Analog Input : use a potentiometer to control the blinking of an LED. 模拟输入 :使用电位器来控制LED的闪烁。
AnalogWriteMega : fade 12 LEDs on and off, one by one, using an Arduino Mega board. AnalogWriteMega :淡出12LED开启和关闭,一个接一个,使用一个Arduino兆丰板。
Calibration : define a maximum and minimum for expected analog sensor values. 校准 :定义一个最高和最低预期的模拟传感器值。
Fading : use an analog output (PWM pin) to fade an LED. :使用模拟输出(PWM引脚)褪的LED
Smoothing : smooth multiple readings of an analog input. 平滑 :平滑的模拟输入多个读数。
4.Communication 4.Communication
These examples include code that allows the Arduino to talk to Processing sketches running on the computer. 这些例子包括代码,允许在Arduino谈在计算机上运行的处理草图。 For more information or to download Processing, see . There are also Max/MSP patches that can communicate with each Arduino sketch as well. 欲了解更多信息或下载处理,看到也有MAX / MSP的补丁,可以沟通与每个Arduino的草图以及。 For more on Max/MSP see Cycling 74 . Max / MSP中, 骑自行车74 For Pd patches that can communicate with these sketches, see Scott Fitzgerald's examples .对于钯补丁,可以沟通,这些草图,看到斯科特·菲茨杰拉德的例子
ASCII Table : demonstrates Arduino's advanced serial output functions. ASCII表 :演示阿尔杜伊诺先进的串行输出功能。
Dimmer : move the mouse to change the brightness of an LED. 调光 :移动鼠标来改变LED的亮度。
Graph : send data to the computer and graph it in Processing. 图表 :发送数据的计算机和图形处理中。
Physical Pixel : turn a LED on and off by sending data to your Arduino from Processing or Max/MSP. 物理像素 :打开加工或Max / MSP的数据发送到您的ArduinoLED和关闭。
Virtual Color Mixer : send multiple variables from Arduino to your computer and read them in Processing or Max/MSP. 虚拟调 :从阿尔杜伊诺到您的计算机发送多变量,和他们在处理或Max / MSP的阅读。
Serial Call Response : send multiple vairables using a call-and-response (handshaking) method. 串行调用的响应 :发送多个vairables使用调用和响应(握手)方法。
Serial Call Response ASCII : send multiple variables using a call-and-response (handshaking) method, and ASCII-encode the values before sending. 串行调用的响应ASCII :发送多个变量,调用和响应(握手)的方法,和ASCII编码发送前值。
SerialEvent : Demonstrates the use of SerialEvent (). SerialEvent :演示使用的SerialEvent()。
Serial input (Switch (case) Statement) : how to take different actions based on characters received by the serial port. 串行输入(开关(案件)声明) :如何采取不同的行动基于串口接收到的字符。
MIDI : send MIDI note messages serially. MIDI :串行发送MIDI音符信息。
MultiSerialMega : use two of the serial ports available on the Arduino Mega. MultiSerialMega :使用两个可用串行端口的Arduino万。
5.Control Structures 5。控制结构
If Statement (Conditional): how to use an if statement to change output conditions based on changing input conditions. 如果声明 (视情况而定):如何使用if语句来改变输出条件改变输入条件的基础上。
For Loop : controlling multiple LEDs with a for loop and. 循环 :循环控制多个 LED
Array : a variation on the For Loop example that demonstrates how to use an array. 数组 For循环的例子演示了如何使用数组的变化。
While Loop : how to use a while loop to calibrate a sensor while a button is being read. While循环 :如何使用一个while循环来校准传感器,而正在读取一个按钮。
Switch Case : how to choose between a discrete number of values. 切换案例 :如何选择之间的离散值的数量。Equivalent to multiple If statements.相当于多个if语句。This example shows how to divide a sensor's range into a set of four bands and to take four different actions depending on which band the result is in.这个例子显示如何分成一组四阶传感器的范围,并采取四种不同的行动,取决于频段的结果是英寸
Switch Case 2 : a second switch-case example, showing how to take different actions based in characters received in the serial port. 切换案例2 :第二个开关的案例,说明如何采取不同的行动基于串口接收到的字符。
6.Sensors 6.Sensors
ADXL3xx : read an ADXL3xx accelerometer. ADXL3xx :读取ADXL3xx加速度。
Knock : detect knocks with a piezo element. :检测用压电元件敲。
Memsic2125 : two-axis acceleromoter. memsic2125 :两轴acceleromoter
Ping : detecting objects with an ultrasonic range finder. :用超声波测距仪检测对象。
7.Display 7.Display
Examples of basic display control基本陈列控制的例子
LED Bar Graph : how to make an LED bar graph. LED条形图 :如何使一个LED条形图。
Row Column Scanning : how to control an 8x8 matrix of LEDs . 行的列扫描 :如何控制LED 8x8的矩阵。
8.Strings 8.Strings
StringAdditionOperator : add strings together in a variety of ways. StringAdditionOperator :中添加各种不同的方式串在一起。
StringAppendOperator : append data to strings. StringAppendOperator :数据追加到字符串。
StringCaseChanges : change the case of a string. StringCaseChanges :改变一个字符串的情况下。
StringCharacters : get/set the value of a specific character in a string. StringCharacters :获取/设置一个字符串中特定字符的值。
StringComparisonOperators : compare strings alphabetically. StringComparisonOperators :比较字符串按字母顺序排列。
StringConstructors : how to initialize string objects. StringConstructors :如何初始化字符串对象。
StringIndexOf : look for the first/last instance of a character in a string. StringIndexOf :寻字符串中的字符的第一个/最后一个实例。
StringLength & StringLengthTrim : get and trim the length of a string. StringLength StringLengthTrim :获取和修剪一个字符串的长度。
StringReplace : replace individual characters in a string. StringReplace :替换字符串中的单个字符。
StringStartsWithEndsWith : check which characters/substrings a given string starts or ends with. StringStartsWithEndsWith :检查一个给定的字符串字符/子串开始或结尾。
StringSubstring : look for "phrases" within a given string. StringSubstring :看短语在一个给定的字符串。
Libraries 图书馆
Examples from the libraries that are included in the Arduino software.从库是包含在Arduino软件的例子。
EEPROM Library EEPROM的图书馆
EEPROM Clear : clear the bytes in the EEPROM. EEPROM清除 :清除字节的EEPROM
EEPROM Read : read the EEPROM and send its values to the computer. EEPROM读 :读EEPROM和计算机发送其值。
arduino字符串转数组∙ EEPROM Write : stores values from an analog input to the EEPROM. EEPROM写 :从存储到EEPROM的模拟输入值。
Ethernet Library以太网图书馆
ChatServer : set up a simple chat server. ChatServer :建立一个简单的聊天服务器。
WebClient : make a HTTP request. WebClient的 :做一个HTTP请求。
WebServer : host a simple HTML page that displays analog sensor values. Web服务器 :承载一个简单的HTML页面,显示模拟传感器的值。
PachubeClient : connect to Pachube, a free datalogging site. PachubeClient :连接到Pachube,一个免费的数据记录网站。
PachubeClientString : send strings to Pachube. PachubeClientString :发送字符串到Pachube
BarometricPressureWebServer : outputs the values from a barometric pressure sensor as a web page. BarometricPressureWebServer :从网页气压传感器的输出值。
UDPSendReceiveString : Send and receive text strings via UDP. UDPSendReceiveString :通过UDP发送和接收文本字符串。
UdpNtpClient : Query a Network Time Protocol (NTP) server using UDP. UdpNtpClient :查询网络时间协议(NTP)服务器使用UDP
DnsWebClient : DNS and DHCP-based Web client. DnsWebClient DNSDHCP基于Web客户端。
DhcpChatServer : A simple DHCP Chat Server DhcpChatServer :一个简单的DHCP聊天服务器
DhcpAddressPrinter : Get an IP address via DHCP and print it out DhcpAddressPrinter :通过DHCPIP地址,并打印出来
TwitterClient : A Twitter client with Strings TwitterClient :与弦乐的Twitter客户端
TelnetClient : A simple Telnet client TelnetClient :一个简单的Telnet客户端
Firmata Libraries firmata图书馆
Guide to the Standard Firmata Library 指南标准Firmata图书馆
LiquidCrystal Library LiquidCrystal图书馆
Hello World : displays "hello world!" 你好世界 :显示“Hello World”and the seconds since reset.和秒自复位。
Blink : control of the block-style cursor. 闪烁 :控制块式游标。
Cursor : control of the underscore-style cursor. 光标 :下划线式游标控制。
Display : quickly blank the display without losing what's on it. 显示 :迅速不失它显示空白。
TextDirection : control which way text flows from the cursor. TextDirection :控制方式文本从光标流动。
Scroll : scroll text left and right. 滚动 :滚动文本的左边和右边。
Serial input : accepts serial input, displays it. 串行输入 :接收串行输入,显示它。
SetCursor : set the cursor position. SetCursor :设置光标位置。
Autoscroll : shift text right and left. 自动滚屏 :移文本左,右。
SPI Library SPI
BarometricPressureSensor : read air pressure and temperature from a sensor using the SPI protocol. BarometricPressureSensor :读空气压力和温度传感器使用SPI协议。
SPIDigitalPot : control a AD5206 digital potentiometer using the SPI protocol. SPIDigitalPot :控制1 AD5206数字电位器使用SPI协议。
Servo Library伺服图书馆
Knob : control the shaft of a servo motor by turning a potentiometer. 旋钮 :控制伺服电机轴转动电位。
Sweep : sweeps the shaft of a servo motor back and forth. 扫描 :扫描轴伺服电机来回。
Software Serial Library软件序列库
Software Serial Example : how to use the Because sometimes one serial port just isn't enough! 软件序列为例 :如何使用SoftwareSerial的图书馆......因为有时候一个串行端口是不够的!
Two Port Receive : how to work with multiple software serial ports. 两个端口接收 :如何使用多个软件的串行端口。
Stepper Library步进图书馆
Motor Knob : control a highly accurate stepper motor using a potentiometer. 电机旋钮 :控制高度精确的步进电机使用电位。
Wire Library电线库
SFRRanger_reader : read a Devantech SRFxx ultra-sonic range finder using I2C communication. SFRRanger_reader :读1 Devantech SRFxx超声波测距仪使用I2C通信。
digital_potentiometer : control a AD5171 digital pot using the Wire Library. digital_potentiometer :控制1 AD5171数字电位器使用的电线库。
master reader/slave sender : set up two (or more) arduino boards to share information via a master reader/slave sender configuration. 主读卡器/从发件人 :成立两个(或更多)的Arduino板通过主读者/从发件人配置共享信息。
master writer/slave reader : allow two (or more) arduino boards to share information using a master writer/slave reader set up. 主作家/从读者 :让两个(或更多)的Arduino板成立主作家/从读者信息共享。
Arduino as ISP Programmer阿尔杜伊诺作为ISP编程
ArduinoISP turns your Arduino into an in-circuit programmer to re-program Atmega chips. ArduinoISP重新编程ATMEGA芯片在电路编程变成你的Arduino Useful when you need to re-load the bootloader on an Arduino, if you're going from Arduino to an Atmega on a breadboard , or if you're making your own Arduino-compatible circuit on a breadboard .当您需要重新加载一个Arduinobootloader,如果你打算从Arduino的面包板ATMEGA ,或者如果你让自己的面包板兼容的Arduino电路
More更多
For a huge list of examples from the Arduino community, see the interfacing with hardware page on the playground wiki.一个巨大的Arduino社区的例子列表,看到操场维基页面与硬件的接口 Also see the list of old examples .还可
LED条形图
The bar graph - a series of LEDs in a line, such as you see on an audio display - is a common hardware display for analog sensors.条形图-如您音频显示屏上看到,在一条线的 LED系列-是常见的硬件显示一个模拟传感器。 It's made up of a series of LEDs in a row, an analog input like a potentiometer, and a little code in between.它是由行系列的 LED,像一个电位器的模拟输入,以及很少的代码之间。 You can buy multi-LED bar graph displays fairly cheaply, like this one .你可以买多LED条形图显示相当便宜一样, 这一个 。 This tutorial demonstrates how to control a series of LEDs in a row, but can be applied to any series of digital outputs.本教程演示了如何控制在一排的LED系列,但可以适用于任何数字输出。
This tutorial borrows from the For Loop and Arrays tutorial as well as the Analog Input tutorial.本教程中,借用了For循环和数组教程以及模拟输入教程。
The sketch works like this: first you read the input.素描作品是这样的:首先,你读的输入。 You map the input value to the output range, in this case ten LEDs .你映射输入输出范围值,
在这种情况下,十发光二极管 。 Then you set up a for loop to iterate over the outputs.然后你建立一个for循环来遍历输出。 If the output's number in the series is lower than the mapped input range, you turn it on.如果输出的系列中的数量是低于对应的输入范围,你打开它。 If not, you turn it off.如果没有,你把它关掉。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。