Japanese |
M5Stack-mruby is mruby runtime environment on M5Stack micro computer.
M5Stack-mruby provide mruby programming platform in below.
- Execution of mruby application (binary).
- Execution of mruby script in interactive mode.
Please install the following software required to build M5Stack-mruby
.
Change to the directory where you installed esp-idf
and get the source code of M5Stack-mruby
.
cd ~/esp
git clone --recursive https://github.com/mimaki/M5Stack-mruby.git
Connect M5Stack and PC with USB cable.
Type below command at M5Stack-mruby
directory.
make flash
M5Stack-mruby
can execute mruby application (binary) compiled with mruby compiler (mrbc).
The mruby compiler (mrbc) is generated in the M5Stack-mruby/components/mruby_component/mruby/bin
directory.
The sample program japan.rb
and the procedure to compile it are shown below.
LCD.clear
LCD.fill_rect(50, 40, 219, 159, LCD::WHITE)
LCD.fill_circle(160, 120, 50, LCD::RED)
gets
M5Stack-mruby/components/mruby_component/mruby/bin/mrbc -o autorun.mrb japan.rb
Insert the microSD card whose autorun.mrb
is copied to the root directory into the M5Stack's SD card slot and power on (or reset) the M5Stack to execute the mruby application saved on the microSD card.
- The file name of the mruby application binary to execute should be
autorun.mrb
. - Copy
autorun.mrb
to the microSD card root directory.
By using a terminal application such as CoolTerm, M5Stack-mruby
interactive mode can be used.
The operation when using CoolTerm is shown below.
Connect M5Stack to PC with USB cable, open CoolTerm Options
, and set the following items.
Item | Value | Note |
---|---|---|
Port | Mac: SLAB_USBtoUART Windows: COMx |
COMx number is different depending on the environment. |
Baudrate | 115200 | |
Data Bits | 8 | |
Parity | none | |
Stop Bits | 1 |
If you can not find Port
, confirm the VCP driver is correctly installed.
Item | Value |
---|---|
Terminal Mode | Line Mode |
Enter Key Emulation | CR |
Local Echo | ON |
- Click
Connect
onCoolTerm
. - Remove the microSD card and press the M5Stack
RESET button
. - Ruby script is executed when Ruby script and
Enter
are input in the input box at the bottom ofCoolTerm
.