Professional Documents
Culture Documents
Language Software Energia
Language Software Energia
Energia programs can be divided in three main parts: structure, values (variables and constants),
and functions.
Structure
setup()
loop()
Control
Variables
Functions
Constants
Digital I/O
HIGH | LOW
pinMode()
INPUT | OUTPUT
digitalWrite()
INPUT_PULLUP |
digitalRead()
Structures
if
INPUT_PULLDOWN
Analog I/O
if...else
true | false
analogReference()
for
integer constants
analogRead()
switch case
while
D a t a Ty p e s
- PWM
do... while
void
break
boolean
tone()
continue
char
noTone()
return
unsigned char
shiftOut()
goto
byte
shiftIn()
int
pulseIn()
Fu r t h e r S y n t a x
Advanced I/O
; (semicolon)
unsigned int
{} (curly braces)
word
millis()
// (single line
long
micros()
unsigned long
delay()
float
delayMicrosecond
Time
comment)
/* */ (multi-line
comment)
s()
#define
double
#include
Math
min()
Arithmetic
Operators
= (assignment
operator)
+ (addition)
- (subtraction)
* (multiplication)
/ (division)
% (modulo)
Comparison
Operators
== (equal to)
!= (not equal to)
String - object
max()
array
abs()
Conversion
constrain()
char()
map()
byte()
pow()
int()
sqrt()
word()
Tr i g o n o m e t r y
long()
sin()
float()
cos()
Va r i a b l e S c o p e & Q u a l i fi e r s
tan()
variable scope
Random Numbers
static
randomSeed()
volatile
const
Utilities
random()
Bits and Bytes
lowByte()
equal to)
sizeof()
highByte()
bitRead()
Boolean
bitWrite()
Operators
&& (and)
|| (or)
! (not)
Pointer Access
Operators
* dereference
operator
& reference
operator
Bitwise Operators
bitSet()
bitClear()
bit()
External
Interrupts
attachInterrupt()
detachInterrupt()
Interrupts
interrupts()
noInterrupts()
Communication
Serial
Stream
++ (increment)
-- (decrement)
+= (compound
addition)
-= (compound
subtraction)
*= (compound
multiplication)
/= (compound
division)
&= (compound
bitwise and)
|= (compound
bitwise or)