Built-in Blocks
The Built-in group contains the blocks that every program needs: events, control flow, logic, math and variables. The pictures below are the real blocks as they appear in the editor; hover help texts are shown under each block.
Events and program structure
when board starts and when board loops are the two event blocks, found at the top of Control. They become setup() and loop() in the generated code. A program needs at least one of them; blocks outside them are ignored.
Variables
Open Variables and click Create variable… to add a variable. You then get:
- set variable to … to store a value;
- change variable by … to add to it;
- the variable itself, to use its value in any input.
Variables are whole numbers (long in the generated code) that start at 0. They are global, so a value stored in starts is still there in loops.
Tips
- Numbers in math blocks can be negative or decimal, but variables hold whole numbers: storing 2.7 keeps 2.
- map … from … – … to … – … rescales a value, for example from an analog reading (0–1023) to a servo angle (0–180).
- random integer from … to … includes both limits.
Ready to try it?
Sign in with Google, pick a board and run your first simulation in two minutes. Free during the launch period.
Start simulating free