Blocks Reference

Catalog of available blocks and how they translate to Arduino-style C++ for ESP32.

About the Blocks

Powered by Google Blockly with custom code generators that output Arduino-style C++.

Start

  • Setup once — Adds lines to setup().
  • Repeat forever — Contents become the loop() body.

Control

  • Repeat times (n) — Loop a block of statements n times.
  • Wait (seconds) — Emits delay(seconds * 1000) in loop().
  • If — Standard conditional.

Logic

  • Compare==, !=, <, >, <=, >=.
  • Booleantrue or false.

Pins

  • Pin mode — Emits pinMode(pin, INPUT/OUTPUT) in setup().
  • Digital write — Emits digitalWrite(pin, HIGH/LOW) in loop().
  • Built‑in LED — Shortcut to control the board LED if available.
  • Read button — Emits digitalRead(pin).

Sensors

  • Ultrasonic setup — Initializes NewPing with trigger/echo pins and injects required #include and globals.
  • Ultrasonic read (cm) — Returns distance in centimeters.

Actuators

  • Servo attach — Uses ESP32Servo to attach a servo and adds necessary #include and global instance.
  • Servo write (°) — Sets servo angle from 0–180°.

Math

  • Number — Numeric literal.
  • Arithmetic — Add, subtract, multiply, divide.