“Arduino语法参考”的版本间的差异
来自YFRobotwiki
(→Arduino语法参考) |
|||
(未显示2个用户的39个中间版本) | |||
第1行: | 第1行: | ||
+ | === [http://www.arduino.cc/en/Reference Arduino官方语法参考] === | ||
− | '''Arduino语法 | + | === Arduino编程语法参考 === |
+ | |||
+ | ::'''Arduino 程序可分为三个主要部分:结构、值(变量和常量),和功能。''' | ||
+ | |||
+ | ---- | ||
+ | |||
+ | {| border="0" cellpadding="10" width="100%" | ||
+ | |- | ||
+ | |width="33%" valign="top" align="left"| | ||
+ | <font color="olivedrab" size="+2">'''结构'''</font> | ||
+ | |||
+ | |||
+ | *[[setup()]] | ||
+ | *[[loop()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''控制结构'''</font> | ||
+ | <br> | ||
+ | *[[if(条件判断语句) 和 比较运算符 | if ]] | ||
+ | *[[if/else | if...else]] | ||
+ | *[[for]] | ||
+ | *[[switch case]] | ||
+ | *[[while loops | while]] | ||
+ | *[[do - while | do...while]] | ||
+ | *[[break]] | ||
+ | *[[continue]] | ||
+ | *[[return]] | ||
+ | *[[goto]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''扩展 语法'''</font> | ||
+ | <br> | ||
+ | *[[; (分号)]] | ||
+ | *[[大括号|{} (大括号)]] | ||
+ | *[[注释| // (单行注释) ]] | ||
+ | *[[注释| /**/(多行注释)]] | ||
+ | *[[ define|#define ]] | ||
+ | *[[ include |#include ]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''算术运算符'''</font> | ||
+ | <br> | ||
+ | *[[= (赋值运算符)]] | ||
+ | *[[加,减,乘,除 | + (加)]] | ||
+ | *[[加,减,乘,除 | - (减)]] | ||
+ | *[[加,减,乘,除 | * (乘)]] | ||
+ | *[[加,减,乘,除 | / (除)]] | ||
+ | *[[ % (取模)]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''比较运算符'''</font> | ||
+ | <br> | ||
+ | *[[if(条件判断语句) 和 比较运算符 | == (等于)]] | ||
+ | *[[if(条件判断语句) 和 比较运算符 | != (不等于)]] | ||
+ | *[[if(条件判断语句) 和 比较运算符 | < (小于)]] | ||
+ | *[[if(条件判断语句) 和 比较运算符 | > (大于)]] | ||
+ | *[[if(条件判断语句) 和 比较运算符 | <= (小于等于)]] | ||
+ | *[[if(条件判断语句) 和 比较运算符 | >= (大于等于)]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''布尔运算符'''</font> | ||
+ | <br> | ||
+ | *[[布尔运算符 | && (与)]] | ||
+ | *[[布尔运算符 | || (或)]] | ||
+ | *[[布尔运算符 | ! (非)]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''指针运算符'''</font> | ||
+ | <br> | ||
+ | *[[指针运算符 | * 指针运算符]] | ||
+ | *[[指针运算符 | & 地址运算符]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''位运算符'''</font> | ||
+ | <br> | ||
+ | *[[位与,位或,位异或 | & (位与)]] | ||
+ | *[[位与,位或,位异或 | | (位或)]] | ||
+ | *[[位与,位或,位异或 | ^ (位异或)]] | ||
+ | *[[位非 | ~ (位非)]] | ||
+ | *[[左移,右移 | << (左移)]] | ||
+ | *[[左移,右移 | >> (右移)]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''复合运算符'''</font> | ||
+ | <br> | ||
+ | *[[++ / -- | ++ (增加)]] | ||
+ | *[[++ / -- | -- (减少)]] | ||
+ | *[[+= , -= , *= , /= | += (复合加)]] | ||
+ | *[[+= , -= , *= , /= | -= (复合减)]] | ||
+ | *[[+= , -= , *= , /= | *= (复合乘)]] | ||
+ | *[[+= , -= , *= , /= | /= (复合除)]] | ||
+ | *[[+= , -= , *= , /= | %= (复合模)]] | ||
+ | *[[复合位与 | &= (复合位与)]] | ||
+ | *[[复合位或 | |= (复合位或)]] | ||
+ | |||
+ | |width="33%" valign="top" align="left"| | ||
+ | <font color="darkcyan" size="+2">'''变量'''</font><br> | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''常量'''</font> | ||
+ | <br> | ||
+ | *[[常量|HIGH]]|[[常量|LOW]] | ||
+ | *[[常量|INPUT]]|[[常量|OUTPUT]]|[[常量|INPUT_PULLUP]] | ||
+ | *[[常量|LED_BUILTIN]] | ||
+ | *[[常量|true]]|[[常量|false]] | ||
+ | *[[integer constants(整型常量)]] | ||
+ | *[[floating point constants(浮点型常量)]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''数据类型'''</font> | ||
+ | <br> | ||
+ | *[[void]] | ||
+ | *[[boolean]] | ||
+ | *[[char]] | ||
+ | *[[unsigned char]] | ||
+ | *[[byte]] | ||
+ | *[[int]] | ||
+ | *[[unsigned int]] | ||
+ | *[[word]] | ||
+ | *[[long]] | ||
+ | *[[unsigned long]] | ||
+ | *[[short]] | ||
+ | *[[float]] | ||
+ | *[[double]] | ||
+ | *[[string - char array|string]] - char array | ||
+ | *[[String - object|String]] - object | ||
+ | *[[array]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''数据类型转换'''</font> | ||
+ | <br> | ||
+ | *[[char()]] | ||
+ | *[[byte()]] | ||
+ | *[[int()]] | ||
+ | *[[word()]] | ||
+ | *[[long()]] | ||
+ | *[[float()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''变量作用域'''</font> | ||
+ | <br> | ||
+ | *[[variable scope]] | ||
+ | *[[static]] | ||
+ | *[[volatile]] | ||
+ | *[[const]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''辅助工具'''</font> | ||
+ | <br> | ||
+ | *[[sizeof]]() | ||
+ | *[[PROGMEM]] | ||
+ | |||
+ | |width="33%" valign="top" align="left"| | ||
+ | <font color="chocolate" size="+2">'''函数'''</font><br> | ||
+ | <br> | ||
+ | <font color="orange" size="+1" >'''数字I/O'''</font> | ||
+ | <br> | ||
+ | *[[pinMode()]] | ||
+ | *[[digitalWrite()]] | ||
+ | *[[digitalRead()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''模拟I/O'''</font> | ||
+ | <br> | ||
+ | *[[analogReference()]] | ||
+ | *[[analogRead()]] | ||
+ | *[[analogWrite()]] - PWM | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''只适用于Due & Zero板'''</font> | ||
+ | <br> | ||
+ | *[[analogReadResolution()]] | ||
+ | *[[analogWriteResolution()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''高级I/O'''</font> | ||
+ | <br> | ||
+ | *[[tone()]] | ||
+ | *[[noTone()]] | ||
+ | *[[shiftOut()]] | ||
+ | *[[shiftIn()]] | ||
+ | *[[pulseIn()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''时间'''</font> | ||
+ | <br> | ||
+ | *[[millis()]] | ||
+ | *[[micros()]] | ||
+ | *[[delay()]] | ||
+ | *[[delayMicroseconds()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''数学'''</font> | ||
+ | <br> | ||
+ | *[[min()]] | ||
+ | *[[max()]] | ||
+ | *[[abs()]] | ||
+ | *[[constrain()]] | ||
+ | *[[map()]] | ||
+ | *[[pow()]] | ||
+ | *[[sqrt()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''三角函数'''</font> | ||
+ | <br> | ||
+ | *[[sin()]] | ||
+ | *[[cos()]] | ||
+ | *[[tan()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''随机数'''</font> | ||
+ | <br> | ||
+ | *[[randomSeed()]] | ||
+ | *[[random()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''位操作'''</font> | ||
+ | <br> | ||
+ | *[[lowByte()]] | ||
+ | *[[highByte()]] | ||
+ | *[[bitRead()]] | ||
+ | *[[bitWrite()]] | ||
+ | *[[bitSet()]] | ||
+ | *[[bitClear()]] | ||
+ | *[[bit()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''外部中断'''</font> | ||
+ | <br> | ||
+ | *[[attachInterrupt()]] | ||
+ | *[[detachInterrupt()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''中断'''</font> | ||
+ | <br> | ||
+ | *[[interrupts()]] | ||
+ | *[[noInterrupts()]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''串口通信'''</font> | ||
+ | <br> | ||
+ | *[[Serial]] | ||
+ | *[[Stream]] | ||
+ | <br> | ||
+ | <font color="orange" size="+1">'''USB (仅适用于 基于芯片32u4的板和Due/Zero)'''</font> | ||
+ | <br> | ||
+ | *[[Mouse and Keyboard libraries |Keyboard]] | ||
+ | *[[Mouse and Keyboard libraries |Mouse]] | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | |||
+ | [[首页|返回首页]] | ||
+ | |||
+ | 欢迎加入群聊:[https://jq.qq.com/?_wv=1027&k=466mOjv 技术交流群] | ||
+ | |||
+ | 原文出处:[http://www.arduino.cc/en/Reference Arduino官网] | ||
+ | |||
+ | 更多建议和问题欢迎反馈至 [http://www.yfrobot.com YFRobot论坛] |
2024年5月21日 (二) 16:26的最后版本
Arduino官方语法参考
Arduino编程语法参考
- Arduino程序可分为三个主要部分:结构、值(变量和常量),和功能。
结构
|
变量
|
函数
|
欢迎加入群聊:技术交流群
原文出处:Arduino官网
更多建议和问题欢迎反馈至 YFRobot论坛