Language Reference Arduino

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Language Reference Arduino as PDF for free.

More details

  • Words: 325
  • Pages: 2
Language Reference Structure •

void setup()



void loop()

Control Structures

Functions Digital I/O •

pinMode(pin, mode)



digitalWrite(pin, value)



int digitalRead(pin)



if



if...else



for



int analogRead(pin)



switch case



analogWrite(pin, value) - PWM



while



do... while



break



continue



return

Further Syntax •

; (semicolon)



{} (curly braces)



// (single line comment)



/* */ (multi-line comment)

Arithmetic Operators •

= (assignment)



+ (addition)



- (subtraction)



* (multiplication)



/ (division)



% (modulo)

Comparison Operators •

== (equal to)



!= (not equal to)



< (less than)



> (greater than)



<= (less than or equal to)



>= (greater than or equal to)

Analog I/O

Advanced I/O •

shiftOut(dataPin, clockPin, bitOrder, value)



unsigned long pulseIn(pin, value)

Time •

unsigned long millis()



unsigned long micros()



delay(ms)



delayMicroseconds(us)

Math •

min(x, y)



max(x, y)



abs(x)



constrain(x, a, b)



map(value, fromLow, fromHigh, toLow, toHigh)



pow(base, exponent)



sq(x)



sqrt(x)

Trigonometry •

sin(rad)



cos(rad)

Boolean Operators



tan(rad)



&& (and)



|| (or)



randomSeed(seed)



! (not)



long random(max)



long random(min, max)

Compound Operators

Random Numbers



++ (increment)



-- (decrement)



+= (compound addition)



-= (compound subtraction)



*= (compound multiplication)



char()



/= (compound division)



byte()

Variables



int()

Variables are expressions that you can use in programs to store values, such as a sensor reading from an analog pin.



long()



float()

Data Types

Communication •

Serial

Conversion

Constants

Variables can have various types, which are Constants are particular values with specific described below. meanings. • boolean • HIGH | LOW •

char



INPUT | OUTPUT



byte



true | false



int



Integer Constants



unsigned int



long



unsigned long



float



double



string



array



void

Related Documents

Language Reference
December 2019 27
Arduino
October 2019 31
Cobol Language Reference
November 2019 10
C Language Reference Manual
November 2019 43