Statements

if(condition_is_true){do_this;}
else if(this_condition_true){do_that;}
else(do_this;)

for(variable; condition; variable_update){
do_this_while_condition_true;}

while(condition_is_true){
do_this;}

Functions

Hardware Functions

pinMode(pin_number,INPUT);
pinMode(pin_number,OUTPUT);
pinMode(pin_number,INPUT_PULLUP);
digitalWrite(pin_number,HIGH/LOW);
digitalRead(pin_number);
analogRead(pin_number);
analogWrite(pin_number, 0- 255);
tone(pin_number, frequency_in_hertz);
noTone(pin_number);

Time Functions

millis(); 
delay(milliseconds_to_delay);

Communication Functions

Serial.begin(baud_rate);
Serial.print("message" or value);
Serial.println("message" or value);

Math Functions

min(first_value,second_value);
max(first_value, second_value);
abs(value_to_get_absolute_value_of);
map(value,from_low,from_high,to_low,to_high);
random(min_value,max_value);

Syntax

void setup(){ code here runs once}
void loop() {code here repeats forever}
; semicolons end the line
//single line comment
/* multi-line comment */
#include <library_name.h>

Variables

byte: 0-255
int: -32,767 to 32,767
bool: 0 or 1
char: -128 to 127
array: variable_type array_name [size_of_array];
const: makes a variable constant

Operators

= assignment of variables or values
+, -, *, / math operators
% modulo 
== equal to
< , > less than, greater than
<= less than or equal to
>= greater than or equal to
&& boolean "and"
|| boolean "or"
! boolean "not"
++ incrementer
-- decrementer