Topics in the www.arduino.cc C Language Reference
Copy-paste from https://www.arduino.cc/en/Reference/HomePage which is © 2017 Arduino
The C Language Reference for Arduino is at the web site above. On the present web page, you are looking at the list of commands. When you are at the web page above, you can click to get examples.
Just having the command list is very helpful as you try to learn how to program Arduino. You can copy this list into a word processor and print this list with four columns to help you remember the commands.
Most people learn C language by following examples.
1 of 3 Structure
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, the remainder when you do an integer division)
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 - advanced
* dereference operator
& reference operator
Bitwise Operators - advanced
& (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)
2 of 3 Variables
Constants
HIGH | LOW
INPUT | OUTPUT | INPUT_PULLUP
LED_BUILTIN
true | false
integer constants
floating point constants
Data Types the common ones are bolded
void
boolean true false
char
unsigned char
byte 0 to 255
int -32,768 to 32,767
unsigned int
word
long -2,147,483,648 to 2,147,483,647 used with millis() and micros()
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 use with interrupts
const
Utilities
sizeof()
PROGMEM
3 of 3 Functions
Digital I/O
pinMode()
digitalWrite()
digitalRead()
Analog I/O
analogReference()
analogRead()
analogWrite() - PWM, pulse width modulation
Due & Zero only
analogReadResolution()
analogWriteResolution()
Advanced I/O
tone()
noTone()
shiftOut() these two require
shiftIn() added integrated circuits
pulseIn()
Time
millis() the milliseconds since the last reset
micros() the microseconds since the last reset
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 - advanced
lowByte()
highByte()
bitRead()
bitWrite()
bitSet()
bitClear()
bit()
External Interrupts - advanced
attachInterrupt() warning, John E has not gotten Due interrupts to work as of August 2017
detachInterrupt()
Interrupts - advanced
interrupts()
noInterrupts()
Communication
Serial as in Serial.println
Stream
USB (32u4 based boards and Due/Zero only)
Keyboard
Mouse