Arduino programs can be divided in three main parts: structure, values (variables and constants), and functions.

Structure

•     setup()    每次 Arduino 上电或重启后,setup 函数只运行一次,用于初始化变量、设置针脚的输出\输入类型、配置串口、引入类库文件等等

•     loop()     该函数在程序运行过程中不断的循环

Control Structures   结构控制

•     if

•     if...else

•     for

•     switch case

•     while

•     do... while

•     break

•     continue

•     return

•     goto

Further Syntax    进一步的语法

•     ; (semicolon)

•     { } (curly braces)

•     // (single line comment)

•     /* */ (multi-line comment)

•     #define

•     #include

Arithmetic Operators   数学运算符

•     = (assignment operator)

•     +  (addition)

•     - (subtraction)

•     * (multiplication)

•     / (division)

•     % (modulo)

Comparison Operators  比较运算符

•     == (equal to)

•     != (not equal to)

•     < (less than)

•     > (greater than)

•     <= (less than or equal to)

•     >= (greater than or equal to)

Boolean Operators    布尔运算符

•     && (and)

•     || (or)

•     ! (not)

Pointer Access Operators    指针运算符

•     * dereference operator

•     & reference operator

Bitwise Operators    位运算符

•     & (bitwise and)

•     | (bitwise or)

•     ^ (bitwise xor)

•     ~ (bitwise not)

•     << (bitshift left)

•     >> (bitshift right)

Compound Operators    比较运算符

•     ++ (increment)

•     -- (decrement)

•     += (compound addition)

•     -= (compound subtraction)

•     *= (compound multiplication)

•     /= (compound division)

•     %= (compound modulo)

•     &= (compound bitwise and)

•     |= (compound bitwise or)

Variables

Constants  常量

•     HIGH | LOW

•     INPUT | OUTPUT |INPUT_PULLUP

•     LED_BUILTIN

•     true | false

•     integer constants

•     floating 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

Functions

Digital I/O

•     pinMode()      引脚定义

•     digitalWrite()   开关量输入

•     digitalRead()   开关量输出

Analog I/O

•     analogReference()     模拟量参考电压设置

•     analogRead()    模拟量输入

•     analogWrite() - PWM    模拟量输出

Due & Zero only

•     analogReadResolution()

•     analogWriteResolution()

Advanced I/O

•     tone()       方波输出

•     noTone()    方波输出取消

•     shiftOut()    串行数据输出

•     shiftIn()     串行数据输入

•     pulseIn()     输入脉冲的高电平时间长度

Time

•     millis()    程序运行时间,毫秒

•     micros()   程序运行时间,微秒

•     delay()   延时函数,毫秒

•     delayMicroseconds()  延时函数,微秒

Math

•     min()  计算最小值

•     max()  计算最大值

•     abs()   绝对值函数

•     constrain()   变量区间限制

•     map()     区间变换函数

•     pow()    幂函数

•     sqrt()   平方根函数

Trigonometry   三角函数

•     sin()

•     cos()

•     tan()

Characters   字符函数

•     isAlphaNumeric()

•     isAlpha()

•     isAscii()

•     isWhitespace()

•     isControl()

•     isDigit()

•     isGraph()

•     isLowerCase()

•     isPrintable()

•     isPunct()

•     isSpace()

•     isUpperCase()

•     isHexadecimalDigit()

Random Numbers

•     randomSeed()       随机数端口定义函数

•     random()    产生伪随机数

Bits and Bytes

•     lowByte()

•     highByte()

•     bitRead()

•     bitWrite()

•     bitSet()

•     bitClear()

•     bit()

External Interrupts

•     attachInterrupt()    外部中断设置

•     detachInterrupt()   外部中断取消

Interrupts

•     interrupts()      中断使能

•     noInterrupts()   中断禁止

Communication

•     Serial

•     Stream

USB (32u4 based boards and Due/Zero only)

•     Keyboard

•     Mouse

Arduino 语法与函数的更多相关文章

  1. Arduino - 串口操作函数与示例代码大全

    来源:https://blog.csdn.net/iracer/article/details/50334041 Arduino - 串口操作函数与示例代码大全 本文总结了Arduino常用串口操作函 ...

  2. python学习第五讲,python基础语法之函数语法,与Import导入模块.

    目录 python学习第五讲,python基础语法之函数语法,与Import导入模块. 一丶函数简介 1.函数语法定义 2.函数的调用 3.函数的文档注释 4.函数的参数 5.函数的形参跟实参 6.函 ...

  3. MySQL 储存过程-原理、语法、函数详细说明

    Mysql储存过程是一组为了完成特定功能的SQL语句集,经过编译之后存储在数据库中,当需要使用该组SQL语句时用户只需要通过指定储存过程的名字并给定参数就可以调用执行它了,简而言之就是一组已经写好的命 ...

  4. openresty开发系列14--lua基础语法3函数

    openresty开发系列14--lua基础语法3函数 一)function (函数) 有名函数: optional_function_scope function function_name( ar ...

  5. Arduino参考手册-函数和变量及电路图

    标题: Arduino参考手册-函数和变量及电路图 作者: 梦幻之心星 sky-seeker@qq.com 标签: [#Arduino,#参考手册,#函数,#变量] 目录: [Arduino] 日期: ...

  6. JAVA基础语法:函数(方法)、类和对象(转载)

    4.JAVA基础语法:函数(方法).类和对象 函数 在java中函数也称为方法,是一段具备某种功能的可重用代码块. 一个函数包括这几部分: 函数头 函数头包括函数访问修饰符,函数返回值类型, 函数名, ...

  7. python基础语法_9-0函数概念

    http://www.runoob.com/python3/python3-function.html 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 函数能提高应用的模块性,和代 ...

  8. Arduino语法-变量和常量

    变量的声明: int led=11 一般变量的声明方法为类型名+变量名+变量初始化值.变量名的写法约定为首字母小写 变量的作用范围又称为作用域,变量的作用范围与该变量在哪儿声明有关,大致分为如下两种: ...

  9. Arduino语法详解_含示例详解

    Arduino 的程序可以划分为三个主要部分:结构.变量(变量与常量).函数. 结构部分 一.结构 1.1 setup() 1.2 loop() 二.结构控制 2.1 if 2.2 if...else ...

随机推荐

  1. Labview学习之路(四)公式和公式节点

    在labview里边,有公式和公式节点两个控件都可以实现表达复杂表达式的功能 公式 位置: 程序框图---编程---Express---算数与比较---公式 用法: 点开后是这个样子 可以任意添加输出 ...

  2. 路由策略Routing Policy和策略路由PBR的区别

    这是面试的时候问道的一个问题,这里跟大家分享一下 路由策略(Routing Policy)是为了改变网络流量所经过的途径而修改路由信息的技术: PBR(policy-based-route)是一种依据 ...

  3. 【经验分享】用adb揪出安卓APP弹窗广告的原形

    背景 相信不少安卓用户中过影子弹窗广告的困扰,这种推广APP本体在后台运行,而且可以在其他APP上弹出覆盖广告,一不小心就会误操作,点击广告或者下载APP,着实令人恶心. 以前的广告软件只在通知栏会推 ...

  4. JVM学习第三天(JVM的执行子系统)之字节码指令

    早上看了Class类文件结构,晚上继续来看字节码指令,毕竟谁也不是一步登天的(说白了还是穷); 字节码指令 Java虚拟机的指令由一个字节长度的.代表着某种特定操作含义的数字(称为操作码,Opcode ...

  5. Java中nextInt和nextLine同时使用出现的问题

    代码: package com.ins1; import java.util.*; public class test { public static void main(String[] args) ...

  6. 对韩峰著《SQL优化最佳实践》P7 案例的质疑

    事先申明下,我的DB环境是Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production,如果与作者环境不同而 ...

  7. 【Flutter 实战】1.20版本更新及新增组件

    老孟导读:Flutter 1.20 更新了 Slider.RangeSlider.日期选择器组件.时间选择器组件的样式,新增了交换组件:InteractiveViewer,下面详细介绍其用法. 滑块 ...

  8. SpringMVC执行流程源码分析

    SpringMVC执行流程源码分析 我们先来看张图片,帮助我们理解整个流程 然后我们开始来解析 首先SpringMVC基于Servlet来运行 那么我们首先来看HttpServletBean这个类 他 ...

  9. Java 的各种内部类、Lambda表达式

    内部类 内部类是指在一个外部类的内部再定义一个类.内部类的出现,再次打破了Java单继承的局限性. 内部类可以是静态 static 的,也可用 public,default,protected 和 p ...

  10. 尤雨溪:TypeScript不会取代JavaScript

    来源 |evrone.com译者 | 核子可乐策划 | 蔡芳芳 近日,Evrone 与 Vue.js 的作者尤雨溪进行了一次访谈,了解他对于无后端与全栈方法.以及 Vue.js 适用场景的看法,还有他 ...