Running Blockly On An EV3 Brick

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

Downloads_—_robot_ev3dev____blockly_—_ssh_—_58×29_and_Hello_World
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 server.py 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 .)
server.py (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).

Hello_World_ev3_blockly

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

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

outAMotor = ev3.Motor('outA')
outAMotor.reset()

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: