What is Blockly?
Blockly is an open-source visual programming editor from Google, now managed by the RaspberryPi Foundation. Instead of writing code character by character, you snap together puzzle-piece blocks that represent logic, loops, variables, and functions. Each arrangement of blocks corresponds to real source code - Blockly generates it for you in the background.
It is widely used in education because it removes the barrier of syntax: you cannot make a typo, forget a semicolon, or misplace a bracket. You focus entirely on the logic of your program.
Our TinyGo generator
Most Blockly environments generate JavaScript or Python. We built a custom Go/TinyGo code generator on top of Blockly so that the same drag-and-drop experience produces code you can flash directly to a microcontroller.
The goal is simple: make it easy to program MCUs, even if you have never written a line of Go. A student can wire up an LED, drag a few blocks, click “To Go”, copy the output, and have real hardware blinking in minutes - no IDE, no compiler toolchain, no terminal.
The generator covers the full TinyGo standard library surface that matters for physical computing: GPIO, time, sensors over I2C/SPI, displays, motors, networking, and more. As the block library grows, so does the range of hardware you can reach without writing a single character.
What you can do
- Drag and drop blocks to build a program - no typing required
- See the generated TinyGo / Go code on demand with the To Go button
- Load demo programs (Hello World, FizzBuzz, Gopherino robot, DS18B20 sensor)
- Save and load your workspace as XML
- Copy generated code to clipboard and flash it to your badge or board
Available block categories
| Category | Blocks |
|---|---|
| Logic | If/else, comparisons, boolean operators |
| Loops | Repeat, while, for-range |
| Math | Numbers, arithmetic, random |
| Text | Strings, print, I/O |
| Lists | Create, get, set, length |
| Colour | Color pickers and values |
| Variables | Typed variables (dynamic) |
| Functions | Define and call Go functions |
| TinyGo | LED control, sleep, goroutines, defer, string conversion (atoi/itoa), read data, tuples |
| GopherBadge | Button input |
| Gopherino | Movement, HC-SR04 distance sensor |
| Sensors - Temp/Hum/Gases | BME280, BMP280, BMP180, BMP388, AHT20, DHT11/DHT22, HTS221, MCP9808, ADT7410, DS18B20, MAX6675, SGP30, SCD4X, ENS160 |
| Sensors - Motion/IMU | MPU6050/6886/9150, ADXL345, LIS3DH, MMA8653, BMA42x, LSM6DSOX, LSM6DS3/TR, BMI160, QMI8658c, L3GD20, LIS2MDL, MAG3110, LSM303AGR/DLHC, LSM9DS1, BNO08x, AS5600 |
| Sensors - Distance/Light | HC-SR04 (ultrasonic), BH1750 (light), APDS9960 (proximity/color/gesture), AMG88xx (thermal 8x8) |
| Sensors - Clock/RTC | DS3231, PCF8523, PCF8563 |
| Sensors - Power/Current | INA219, INA260, AXP192, PCF8591 (ADC) |
| Sensors - Input | Keypad4x4, rotary encoder, MCP3008 (ADC SPI), FT6336 (touch), IR receiver NEC |
| Displays | SH1106 (OLED 128x64), Adafruit4650 (OLED 128x32), PCD8544/Nokia5110, ILI9341 (TFT 320x240), GC9A01 (round TFT 240x240), HD44780 (char LCD), IS31FL3731 (LED matrix), Hub75 (RGB matrix) |
| LEDs | APA102 (SPI strip), micro:bit 5x5 matrix, BlinkM (I2C RGB), WS2812/NeoPixel |
| Network/Comms | ESPAT (ESP8266/ESP32 WiFi), RTL8720DN (WiFi+BLE), SX127x (LoRa), MCP2515 (CAN bus) |
| Control/Motors | Servo, buzzer, EasyStepper, L293x/L9110x (DC motor), PCA9685 (16-ch PWM), MCP23017 (GPIO expander) |
| Others | AT24Cx EEPROM, Seesaw (I2C coprocessor) |
| Net/HTTP | Cloudflare Workers, Fermyon Spin |
| Go Funcs | Define and call reusable Go functions |
Source code
The generator and all block definitions live in the blockly-tinygo repository. Contributions are welcome - whether that is a new sensor block, a fix to generated code, or better demo programs.