BrickLogo is a Logo programming environment for controlling LEGO® motors and sensors. It runs in a terminal and works with hardware from the original DACTA Control Lab through to current Powered UP and LEGO Education Science devices.
LEGO/Logo was designed by Mitchel Resnick, Stephen Ocko, and Seymour Papert at MIT in the 1980s to connect the Logo programming language to physical LEGO models. LEGO produced two implementations: LEGO TC Logo (1988) and LEGO DACTA Control Lab (1993). BrickLogo is a spiritual evolution of LEGO/Logo, drawing from both and adding support for current hardware.
curl -fsSL https://raw.githubusercontent.com/openbrickproject/BrickLogo/main/scripts/install.sh | sh
irm https://raw.githubusercontent.com/openbrickproject/BrickLogo/main/scripts/install.ps1 | iex
This installs BrickLogo to ~/.bricklogo/ and adds it to your PATH. Run bricklogo to start.
Download the latest release for your platform, unpack it, and run the binary.
./bricklogo
Example session:
? connectto "pup "mybot
Scanning for Powered UP hub...
Connected to Boost Move Hub as "mybot"
? talkto "a
? setpower 50
? onfor 10
? to backandforward
> repeat 4 [onfor 5 wait 5 rd]
> end
? backandforward
Multiple devices can be connected at the same time. Each is given a name and addressed by that name or by qualified port names (for example "mybot.a).
BrickLogo looks for bricklogo.config.json in the current working directory. This is only needed for devices that connect over serial (Control Lab, RCX serial towers, EV3 Bluetooth, NXT Bluetooth). USB and BLE devices are detected automatically.
{
"controllab": ["/dev/tty.usbserial-AC018HBC"],
"rcx": ["/dev/ttyS0"],
"ev3": ["/dev/cu.EV3-SerialPort-14"],
"nxt": ["/dev/cu.NXT-DevB"]
}Serial paths are used in order as devices are connected. WeDo 1.0, RCX USB towers, EV3 USB, and NXT USB connections are detected automatically and do not need a config entry.
Connection:
connectto "type "nameuse "namedisconnect
Motor control:
talkto "portortalkto [a b]on,off,onfor,setpowerseteven,setodd,rdrotate,rotateto,resetzero,rotatetoabsflash,alloff
Sensors:
listento "portsensor "mode,sensor?color,light,force,angle
Language:
make,:variable,print,showrepeat,forever,if,ifelse,waituntilto ... end,output,stop,eraselaunch,task,tasks,kill,killall,waitforwait,timer,resettnamepage,save,load,setdisk
Type help inside BrickLogo for the built-in command summary.
See the docs folder:
cargo check
cargo test
cargo run -p bricklogo
BrickLogo is in active development. The goal is a usable and fun LEGO/Logo environment for automation and learning.
BrickLogo is licensed under the Apache License, Version 2.0. See LICENSE for the full text.
LEGO®, DACTA, Mindstorms, Powered UP, WeDo, Boost, SPIKE, and Technic are trademarks of the LEGO Group of companies, which does not sponsor, authorize, or endorse this project.
Raspberry Pi is a trademark of Raspberry Pi Ltd. BrickLogo is compatible with the Raspberry Pi Build HAT but is not affiliated with, endorsed by, or supported by Raspberry Pi Ltd.
BrickLogo is an independent, unofficial project. All product names, logos, and brands referenced in this project are the property of their respective owners. Use of these names is for identification and compatibility purposes only and does not imply any endorsement.

