Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
381 views

Language Reference Arduino

This document provides an overview of the Arduino language reference, including its core structure and functions for digital and analog I/O, time, math, trigonometry, random numbers, communication and more. It describes the basic syntax elements like comments, operators, variables and data types, and lists many of the key functions available in the Arduino language.

Uploaded by

bignonedu
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
381 views

Language Reference Arduino

This document provides an overview of the Arduino language reference, including its core structure and functions for digital and analog I/O, time, math, trigonometry, random numbers, communication and more. It describes the basic syntax elements like comments, operators, variables and data types, and lists many of the key functions available in the Arduino language.

Uploaded by

bignonedu
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Language Reference

Structure Functions
 void setup() Digital I/O
 void loop()
 pinMode(pin, mode)
Control Structures  digitalWrite(pin, value)
 int digitalRead(pin)
 if
 if...else Analog I/O
 for
 switch case  int analogRead(pin)
 while  analogWrite(pin, value) - PWM
 do... while
 break Advanced I/O
 continue
 return  shiftOut(dataPin, clockPin, bitOrder,
value)
Further Syntax  unsigned long pulseIn(pin, value)

 ; (semicolon) Time
 {} (curly braces)
 // (single line comment)  unsigned long millis()
 /* */ (multi-line comment)  unsigned long micros()
 delay(ms)
Arithmetic Operators  delayMicroseconds(us)

 = (assignment) Math
 + (addition)
 - (subtraction)  min(x, y)
 * (multiplication)  max(x, y)
 / (division)  abs(x)
 % (modulo)  constrain(x, a, b)
 map(value, fromLow, fromHigh,
Comparison Operators toLow, toHigh)
 pow(base, exponent)
 == (equal to)  sq(x)
 != (not equal to)  sqrt(x)
 < (less than)
 > (greater than)
 <= (less than or equal to)
 >= (greater than or equal to)

Boolean Operators
Trigonometry
 && (and)
 || (or)  sin(rad)
 ! (not)  cos(rad)
 tan(rad)
Compound Operators
Random Numbers
 ++ (increment)
 -- (decrement)  randomSeed(seed)
 += (compound addition)  long random(max)
 -= (compound subtraction)  long random(min, max)
 *= (compound multiplication)
 /= (compound division) Communication

 Serial
Variables
Variables are expressions that you can use
in programs to store values, such as a sensor Conversion
reading from an analog pin.
 char()
Data Types
 byte()
 int()
Variables can have various types, which are
described below.  long()
 float()
 boolean
 char
 byte
Constants
 int
 unsigned int Constants are particular values with specific
 long meanings.
 unsigned long
 float  HIGH | LOW
 double  INPUT | OUTPUT
 string  true | false
 array  Integer Constants
 void

You might also like