目录
语法手册
结构部分
结构控制
扩展语法
算数运算符
比较运算符
布尔运算符
指针运算符
位运算符
复合运算符
变量部分
常量
数据类型
数据类型转换
变量作用域 & 修饰符
辅助工具
函数部分
数字 I/O
模拟 I/O
高级 I/O
时间
数学运算
三角函数
随机数
位操作
设置中断函数
开关中断
通讯
语法手册
OCROBOT的程序可以划分为三个主要部分:
结构
、
变量
(变量与常量)、
函数
。
结构部分
setup()
loop()
结构控制
if
if...else
for
switch case
while
do... while
break
continue
return
goto
扩展语法
;(分号)
{}(大括号)
//(单行注释)
/* */(多行注释)
#define
#include
算数运算符
=(赋值运算符)
+(加)
-(减)
*(乘)
/(除)
%(模)
比较运算符
==(等于)
!=(不等于)
<(小于)
>(大于)
<=(小于等于)
>=(大于等于)
布尔运算符
&&(与)
||(或)
!(非)
指针运算符
* 取消引用运算符
& 引用运算符
位运算符
& (bitwise and)
| (bitwise or)
^ (bitwise xor)
~ (bitwise not)
<< (bitshift left)
>> (bitshift right)
复合运算符
++ (increment)
-- (decrement)
+= (compound addition)
-= (compound subtraction)
*= (compound multiplication)
/= (compound division)
&= (compound bitwise and)
|= (compound bitwise or)
变量部分
常量
HIGH
|
LOW
INPUT
|
OUTPUT
true
|
false
integer constants
floating point constants
数据类型
void
boolean
char
unsigned char
byte
int
unsigned int
word
long
unsigned long
float
double
string - char array
String - object
array -(数组)
数据类型转换
char()
byte()
int()
word()
long()
float()
变量作用域 & 修饰符
variable scope
static
volatile
const
辅助工具
sizeof()
函数部分
数字 I/O
pinMode()
digitalWrite()
digitalRead()
模拟 I/O
analogReference()
analogRead()
analogWrite() - PWM
高级 I/O
tone()
noTone()
shiftOut()
shiftIn()
pulseIn()
时间
millis()
micros()
delay()
delayMicroseconds()
数学运算
min()
max()
abs()
constrain()
map()
pow()
sqrt()
ceil()
exp()
fabs()
floor()
fma()
fmax()
fmin()
fmod()
ldexp()
log()
log10()
round()
signbit()
sq()
square()
trunc()
三角函数
sin()
cos()
tan()
acos()
asin()
atan()
atan2()
cosh()
degrees()
hypot()
radians()
sinh()
tanh()
随机数
randomSeed()
random()
位操作
lowByte()
highByte()
bitRead()
bitWrite()
bitSet()
bitClear()
bit()
设置中断函数
attachInterrupt()
detachInterrupt()
开关中断
interrupts()
noInterrupts()
通讯
Serial
Stream