Blocks

Input/Output

Blocks

state of pin — digitalRead()

set pin to — digitalWrite()

read analogue pin — analogRead()

set PWM pin to — analogWrite()

set board LED to — digitalWrite()

tone on pin to — tone()

stop tone on pin — noTone()

light sensor light/dark — custom function

light sensor value — analogRead()

sensor distance — custom function

potentiometer on pin — analogRead()

Logic

Blocks

if – else if – else — if, else if, else

logic comparisons — ==, !=, <, <=, >, >=

logic operations — and, or

logical not — not

boolean true/false — true, false

boolean high/low — HIGH, LOW

ternary operaor — test ? true : false

Loops

Blocks

setup and loop — void setup() and void loop()

reapeat num times — for loop

repeat while — while loop

skip to next loop cycle — continue

break out of loop — break

Timing

Blocks

wait s — delay()

wait ms — delay()

wait μs — delayMicroseconds()

run time in ms — milliseconds()

run time in μs — microseconds()

wait forever — while true

Mathematics

Blocks

number block

arithmetic operations — + - * / **

trigonometric functions — sin(), cos(), tan(), asin(), acos(), atan()

constants — pi, e, phi, sqrt(2), sqrt(1/2), infinity

tests — even, odd, prime, whole, positive, negative, divisible by

round — round(), ceil(), floor()

remainder — x % y

constrain number between values

random integer — custom function

random fraction — rand()

Text

Blocks

character

character tests — isAlpha, isAlphaNumeric, isAscii, isControl, isDigit, isGraph, isHexadecimalDigit, isLowerCase, isPrintable, isPunct, isSpace, isUpperCase, isWhitespace

length of string — String.length()

to upper/lower case — String.toUpperCase(), String.toLowerCase()

string

concatenate strings

append string

in string find index of — String.indexOf(), String.charAt()

trim string — String.trim()

in string replace substring — String.replace()

Variables

Blocks

integer

float

boolean

string

Messaging

Blocks

set serial bitrate — Serial.begin()

serial timeout for ms — Serial.setTimeout()

serial message — Serial.print(), Serial.println()

serial byte — Serial.write()

serial data received — Serial.available() > 0

receive serial message — Serial.readString(), Serial.readStringUntil()

receive serial byte — Serial.read()

receive serial message as number — Serial.parseFloat()

Motion

attach servo on pin

attach servo on pin (custom timing)

detach servo

set servo position

get servo position

add stepper motor (2 pins)

add stepper motor (4 pins)

set stepper speed

set stepper steps

attach L298N motor driver

set L298N motor driver direction

set L298N motor driver speed

Last updated