Running Blockly On An EV3 Brick

Based on WasabiFan/blockly-ev3dev, it seems we can run blockly from a Lego EV3 brick.

I managed to see blockly on default port 8000 by copying the following files from WasabiFan‘s repo into the same directory in a EV3 folder (Sharing Files With a Lego EV3 Brick Over Wifi Using Filezilla), and then running python in that directory:

blockly_compressed.js (from .)
blocks_compressed.js (from .)
en.js (from msg/js)
index.html (from server/)
index.js (from server/)
python_compressed.js (from .) (from server/)

At the moment it only runs a motor command (and note that the speed setting is not a speed setting, it’s a sp_duty_cycle, so needs to be in range 0..100).


The run button saves the program as a python file ( in the folder user_code and then executes it:

robot@ev3dev:~/blockly$ more user_code/ 
import ev3dev.ev3 as ev3

outAMotor = ev3.Motor('outA')

If we can save this as an executable file with a #!/user/bin/python hashbang, the file could then be launched from the brick file browser.

Author: Tony Hirst

I'm a Senior Lecturer at The Open University, with an interest in #opendata policy and practice, as well as general web tinkering...

%d bloggers like this: