Arduino 语法手册精编版
- 格式:docx
- 大小:142.05 KB
- 文档页数:73
16.1analogReference()
16.2analogRead()
16.3analogWrite() PWM
十七、高级I/O
17.1tone()
17.2noTone()
17.3shiftOut()
17.4shiftIn()
17.5pulseIn()
十八、时间
18.1millis()
2.8 continue
2.9 return
2.10 goto
三、扩展语法
3.1 ;(分号)
3.2 {}(花括号)
3.3 //(单行注释)
3.4 /* */(多行注释)
3.5 #define
3.6 #include
四、算数运算符
4.1=(赋值运算符)
4.2 +(加)
4.3 -(减)
4.4 *(Leabharlann )4.5 /(除)11.12double(双精度浮点数)
11.13string(char array/字符串)
11.14String object(String类)
11.15array(数组)
十二、数据类型转换
12.1char()
12.2byte()
12.3int()
12.4word()
12.5long()
12.6float()
10.2INPUT|OUTPUT(数字引脚(Digital pins)定义)
10.3true | false(逻辑层定义)
10.4integer constants(整数常量)
10.5floating point constants(浮点常量)
十一、数据类型
11.1void
11.2boolean(布尔)
19.11 floor()
19.12 fma()
19.13 fmax()
19.14 fmin()
19.15 fmod()
19.16 ldexp()
19.17 log()
19.18 log10()
19.19 round()
19.20 signbit()
19.21 sq()
19.22 square()
19.23 trunc()
18.2micros()
18.3delay()
18.4delayMicroseconds()
十九、数学运算
19.1min()
19.2max()
19.3abs()
19.4constrain()
19.5map()
19.6pow()
19.7sqrt()
19.8ceil()
19.9 exp()
19.10 fabs()
Arduino语法手册
Arduino的程序可以划分为三个主要部分:结构、变量(变量与常量)、函数。
结构部分
一、结构
1.1setup()
1.2loop()
二、结构控制
2.1 if
2.2 if...else
2.3 for
2.4 switch case
2.5 while
2.6 do... while
2.7 break
23.2detachInterrupt()
二十四、开关中断
24.1interrupts()(中断)
24.2noInterrupts()(禁止中断)
二十五、通讯
25.1Serial
25.1.1 if (Serial)
25.1.2 Serial.available()
25.1.3 Serial.begin()
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& (bitwise and)
25.1.4 Serial.end()
25.1.5 Serial.find()
25.1.6 Serial.findUntil()
25.1.7 Serial.flush()
25.1.8 Serial.parseFloat()
25.1.9 Serial.parseInt()
25.1.10 Serial.peek()
9.4-= (compound subtraction)
9.5*= (compound multiplication)
9.6/= (compound division)
9.6&= (compound bitwise and)
9.8|= (compound bitwise or)
变量部分
十、常量
10.1HIGH|LOW(引脚电压定义)
11.3char(有号数据类型)
11.4unsigned char(无符号数据类型)
11.5byte(无符号数)
11.6int(整型)
11.7unsigned int(无符号整型)
11.8word
11.9long(长整数型)
11.10unsigned long(无符号长整数型)
11.11float(浮点型数)
二十、三角函数
20.1 sin()
20.2 cos()
20.3 tan()
20.4 acos()
20.5 asin()
20.6 atan()
20.7 atan2()
20.8 cosh()
20.9 degrees()
20.10 hypot()
20.11 radians()
20.12 sinh()
20.13 tanh()
十三、变量作用域&修饰符
13.1variable scope(变量的作用域)
13.2static(静态变量)
13.3volatile
13.4const
十四、辅助工具
14.1sizeof()
函数部分
十五、数字I/O
15.1pinMode()
15.2digitalWrite()
15.3digitalRead()
8.2| (bitwise or)
8.3^ (bitwise xor)
8.4~ (bitwise not)
8.5<< (bitshift left)
8.6>> (bitshift right)
九、复合运算符
9.1++ (increment)
9.2 --(decrement)
9.3+= (compound addition)
二十一、随机数
21.1randomSeed()
21.2random()
二十二、位操作
22.1 lowByte()
22.2 highByte()
22.3 bitRead()
22.4 bitWrite()
22.5 bitSet()
22.6 bitClear()
22.7 bit()
二十三、设置中断函数
23.1attachInterrupt()