Why Use Virtual Blocks?
No Hardware Required
Write and run SAM Script programs from any device, even when physical blocks are unavailable or not yet distributed.
Faster Testing
Instantly reset, reconnect, and re-run without charging or re-pairing a physical block.
Distance Learning
Students working from home can interact with virtual blocks over their browser — no Bluetooth or physical kit needed.
How to Enable Virtual Blocks
Open the Virtual Blocks panel
In the SAM Script editor, click the Virtual Blocks toggle or button in the toolbar. The panel activates immediately — no page reload required.
See the virtual block representations
On-screen representations of each block type appear in the Virtual Blocks panel. They update in real time as your code runs.
Interact with the virtual blocks
You can click or interact with virtual blocks directly:
- Button — click it to simulate a press and release.
- LED — watch the color and brightness change as your code sets them.
- Light sensor — drag the slider to simulate different ambient light readings.
- Motor and Servo — see animated indicators showing speed, direction, and angle.
Same API, Real or Virtual
You do not need to change a single line of code when switching between virtual and physical blocks. Theconnect call works identically in both cases:
Limitations of Virtual Blocks
No Bluetooth
No Bluetooth
Virtual blocks have no Bluetooth radio. They cannot be detected by other devices and do not appear in the Pair dialog. They exist only within the SAM Script session that created them.
Simulated sensor readings
Simulated sensor readings
Sensors like the light sensor return simulated values based on slider controls in the Virtual Blocks panel. These values are controlled by you or your students rather than reflecting a real physical environment.
No physical feedback
No physical feedback
A virtual buzzer will not produce sound through a speaker, and a virtual motor will not turn a physical wheel. Always validate final projects with real hardware before presenting them.