
Arduino的程序由三个主要部分构成:
- 结构
- 值(变量与常量)
- 函数
Structure
setup()loop()
setup()
The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the Arduino board.
|
|
loop()
After creating a setup() function, which initializes and sets the initial values, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board.
|
|
Variables
Constants
HIGH|LOWINPUT|OUTPUT|INPUT_PULLUPLED_BUILTINtrue|falseinteger constantsfloating point constants
Data Types
- void
- boolean
- char
- unsigned char
- byte
- int
- unsigned int
- word
- long
- unsigned long
- short
- float
- double
- string - char array
- String - object
- array
Conversion
- char()
- byte()
- int()
- word()
- long()
- float()
Variable Scope & Qualifiers
- variable scope
- static
- volatile
- const
Utilities
- sizeof()
- PROGMEM




近期评论