Arduino Syntax Manual
From Microduino Wiki
Revision as of 07:02, 10 August 2016 by
Fengfeng
(
talk
)
(
diff
)
← Older revision
|
Latest revision
(
diff
) |
Newer revision →
(
diff
)
Jump to:
navigation
,
search
Language:
English
•
中文
Programs of Arduino can be divided into three main parts:Structures, variables(variables and constants) and functions
Structure/Main structure
setup()
loop()
Control Structures
if
if...else
for
switch case
while
do... while
break
continue
return
goto
Further Syntax
; (semicolon)
{}
//
/* */ (Block comment)
#define
#include
Arithmetic Operators/Arithmetic operator
= (Basic assignment)
+ (Addition)
- (Subtraction)
* (Multiplication)
/ (Division)
% (Modulo)
Comparison Operators/Comparison Operator
== (Equal to)
!= (Not equal to)
<
>
<=
>=
Boolean Operators
&& (Logical AND)
|| (Logical or)
! (Logical negation)
Pointer Access Operators
* Indirection
&Address of
Bitwise Operators
& (Bitwise AND)
(Bitwise OR)
^ (Bitwise XOR)
~ (Bitwise NOT)
[[<< (Bitwise left shift)]]
[[>> (Bitwise right shift)]]
Compound Operators
++ (Self-add)
-- (Self-decrease)
+=
-=
*=
/=
%=
&=
|=
Variables
Constants
HIGH | LOW
INPUT | OUTPUT
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& Modifier
variable scope
static
volatile
const
Utilities
sizeof()
ASCII Codes
Functions
Digital I/O
pinMode()
digitalWrite()
digitalRead()
Analog I/O
analogReference()
analogRead()
analogWrite() - PWM
Advanced I/O
tone()
noTone()
shiftOut()
shiftIn()
pulseIn()
Time
millis()
micros()
delay()
delayMicroseconds()
Math/Arithmetical operation
min()
max()
abs()
constrain()
map()
pow()
sqrt()
Trigonometry
sin()
cos()
tan()
Random Numbers
randomSeed()
random()
Bits and Bytes
lowByte()
highByte()
bitRead()
bitWrite()
bitSet()
bitClear()
bit()
External Interrupts
attachInterrupt()
detachInterrupt()
Interrupts/Interrupt of switch
interrupts()
noInterrupts()
Communication
Serial
Stream
Navigation menu
Personal tools
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help
Microduino Series
Series Info
Modules
Kits
Tutorials & Projects
mCookie Series
Series Info
Modules
Kits
Tutorials & Projects
Sensors & Trinkets Series
Series Info
Modules
Tutorials & Projects
Experimental Lab
Experimental Series
Tools
What links here
Related changes
Special pages
Printable version
Permanent link
Page information