E
dit
A
ttach
P
rintable
r2 - 19 Nov 2007 - 16:11:35 -
FlamingoEda
You are here:
TWiki
>
Arduino Web
>
ArduinoChineseReference
说明
您在这里看到的是
Arduino参考手册
的中文版本,目前翻译工作尚未完成,有希望加入的朋友请联系
FlamingoEda
Arduino 参考手册
请从
详细参考手册
?
了解Arduino语言更为高级的特性。
Arduino程序可以划分成三个主要的部分:结构、值(变量和常量)和函数。Arduino语言基于的是C/C++。
结构
一个Arduino程序包括两个部分:
void
setup
?
()
void
loop
?
()
其中setup()是准备工作, 而loop()则是真正的执行过程。setup这一部分通常位于程序的最前面,你会设置
接口模式
?
,或是初始化串行通信等。loop这一部分是要执行的代码——读取输入,触发输出等。
Variable Declaration
?
Function Declaration
?
void
?
控制结构
if
?
if...else
?
for
?
switch case
?
while
?
do... while
?
break
?
continue
?
return
?
更多语法
;
?
(分号)
{}
?
(大括号)
//
?
(单行注释)
/* */
?
(多行注释)
数学运算符
+
?
(加)
-
?
(减)
*
?
(乘)
/
?
(除)
%
?
(取模)
比较运算符
==
?
(相等)
!=
?
(不等)
<
?
(小于)
>
?
(大于)
<=
?
(小于等于)
>=
?
(大于等于)
布尔运算符
&&
?
(与)
||
?
(或)
!
?
(非)
变量
变量是程序中你能够用来保存值的表达式,比如从模拟管脚读入的传感器的值。
常量
常量是有特定含义的某个值。
HIGH
?
|
LOW
?
INPUT
?
|
OUTPUT
?
整数常量
?
数据类型
变量可以有如下所示的不同的类型,
boolean
?
char
?
byte
?
int
?
unsigned int
?
long
?
unsigned long
?
float
?
double
?
string
?
array
?
函数
数字输入/输出
pinMode
?
(pin, mode)
digitalWrite
?
(pin, value)
int
digitalRead
?
(pin)
模拟输入/输出
int
analogRead
?
(pin)
analogWrite
?
(pin, value) - PWM
高级输入/输出
shiftOut
?
(dataPin, clockPin, bitOrder, value)
unsigned long
pulseIn
?
(pin, value)
--
FlamingoEda
- 19 Nov 2007
E
dit
|
A
ttach
|
P
rintable
|
R
aw View
|
Backlinks:
We
b
,
A
l
l Webs
|
H
istory
: r2
<
r1
|
M
ore topic actions
Arduino
Log In
or
Register
Arduino Web
Create New Topic
Index
Search
Changes
Notifications
Statistics
Preferences
Webs
Arduino
Main
Processing
Sandbox
TWiki
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback