File Exchange

image thumbnail

Embedded Coder Robot NXT Demo

version (5.99 MB) by Takashi Chikamasa
Offers an enjoyable Model-Based Design experience using Simulink models with Lego robots


Updated 01 Mar 2012

View Version History

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

News! R2012a Simulink supports LEGO MINDSTORMS NXT as a product standard feature. You can play with LEGO even without ECRobot NXT.

- This demo supports R2006a -> R2012a
Simulink plant and controller models are used with LEGO's latest high-tech robot (ARM-based LEGO Mindstorms NXT) to illustrate industrial application of Model-Based Design with Production Code Generation. Take note of the model architecture and component definition, as well as, use of fixed- and floating-point designs.

This demo includes three examples:
Maze walking tricycle robot
Line tracing tricycle robot
Self balancing bi-wheeled robot
NXT Remocon demo

In each example, you can simulate the robot on your personally designed bmp track with 3D virtual reality.

LEGO(R) is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this demo.
LEGO(R) and Mindstorms(R) are registered trademarks of The LEGO Group.

Cite As

Takashi Chikamasa (2021). Embedded Coder Robot NXT Demo (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (36)

linh le

Please help.Could you plese re-gennerate schema.p.
I've tried to run on matlab 2016b.
Caused by:
The P-code file C:\cygwin\ecrobotNXT\environment\@NXT\schema.p was generated prior to MATLAB version 7.5 (R2007b) and is no longer supported. Use pcode to regenerate the file using MATLAB R2007b or later.

Guolong Jiang

Guolong Jiang

"News! R2012a Simulink supports LEGO MINDSTORMS NXT as a product standard feature. You can play with LEGO even without ECRobot NXT. "
I don`t think so. If you don`t install this support, the Virtual Reality will not work as a lack of a lib.

you xi

I'm working with NXT bricki.
I am trying to connect the NXT with my Matlab, 2015b, but it doesn't work.
I have tried differents ways but it does't allow this.
I think the problem could be because the Matlab i have is 64x bits and the NXT brick is 32x bits.
If someone know how to connect the NXT brick would be kind to tell me.


Hello! thank you for your working.
I have some problems, it didnot work with me. I have a matlab R2013.
When I run the simulink file "nxtmouse.mdl", it has the error:
Error evaluating 'InitFcn' callback of Light Sensor Interface block (mask) 'nxtmouse_ctrl/Light Sensor Interface'.
Undefined function or variable 'NXT.Signal'.

Anyone know how to fix it? please help me, thank you very much


Did anybody figure out how to solve this problem with make? I think my 64-Bit Windows 7 might be a problem...
I'm using MATLAB R2014a.

### Executing GNU-ARM toolchain for building executable ...
Compiling /cygdrive/C/Users/LaborPC/Documents/MATLAB/ecrobotNXT/environment/nxtOSEK/toppers_osek/kernel/alarm.c to alarm.o
/bin/sh: '/cygdrive/E/Programme/cygwin/GNUARM'/bin/arm-none-eabi-gcc: No such file or directory
/cygdrive/C/Users/LaborPC/Documents/MATLAB/ecrobotNXT/environment/nxtOSEK/ecrobot/tool_gcc.mak:108: recipe for target 'build/kernel/alarm.o' failed
make: *** [build/kernel/alarm.o] Error 127

Chanthery Elodie

Thank you a lot for this code. I'm facing a problem when I try the nxtbuild function.

### Executing GNU-ARM toolchain for building executable ...
Compiling /cygdrive/C/cygwin64/ecrobotNXT/environment/nxtOSEK/toppers_osek/kernel/alarm.c to alarm.o
/cygdrive/C/cygwin64/ecrobotNXT/environment/nxtOSEK/ecrobot/tool_gcc.mak:110: recipe for target `build/kernel/alarm.o' failed
make: *** [build/kernel/alarm.o] Error 127

Do you have an idea for helping me?
I am on windows 7, with matlab 2012a.

Thank you a lot!

Jen-Yu Hsiao

Sorry, I have a problem...
When I doing code generation > Build Model(ctrl+B)
Simulink appear error message like this:
Data store memory with name 'ServoMotorA' was not found for block 'Copy_of_TestMotorOSEK/Servo Motor Write/Data Store Write'

edris farah



That's happening to me too. It builds the code but then it stops in "### Executing GNU-ARM toolchain for building executable", but doesn't build executable. That happens sometimes, not always...and it's happening now with a very important project. Help, please!


### Executing GNU-ARM toolchain for building executable ... and nothing else for long time. Test for motors was working but that code is not working. What can I do?


fremond khoo

im sorry..i face some problem while installing..can u tell me what's wrong??
and how to solve it??..thanks

Install cancelled
??? Error using ==> install_ecrobot_tools>do_unzip at
Problem unzipping D:\Documents and Settings\user\My
Documents\MATLAB\ECRobotDownloads\ to

Error in ==> install_ecrobot_tools>do_unzip at 456
error('Problem unzipping %s to %s', zipfile,

Error in ==> install_ecrobot_tools>install_ecrobot at

Error in ==> install_ecrobot_tools at 68



when it comes to compiling the files with gnu-arm, i get a lot of the following error messages

C:\cygwin\GNUARM-402\bin\arm-elf-gcc.exe: *** fatal error - couldn't allocate heap, Win32 error 0, ......

arm-elf-gcc 2192 child_copy: stack write copy failed, 0x28D450..0x290000, done 0, windows pid 2675588, Win32 error 5

i am running windows 7, matlab r2010b 64bit. Any help would be appreciated.

Nguyen Hieu

Syed Noman Hussain

v goooooooooddd

eugenio marino

aditya jha

very good

Anas Obeidat

it's Excellent Simulation to NXT robot, but we need a good manual, to explain all circuit components, and how we can develop more demos

Ali Hamouda Ali

nural net and feature extraction

Ali Hamouda Ali

Nabhiraj Yalagoud

very good

Nabhiraj Yalagoud

D kiven

Shein-Yung Cheng

Yasuhiko Matoba

Fatih Can

pezeshki zahra

i want information about robot for my programming

Sina ferdowsi

thast very good
Kind Regards

Takashi Chikamasa

For more detailed info about Embedded Coder Robot NXT, check

Vicente Parra

Wonderful tool. This allows we researchers to devote the short spare time we have to support mindstrom based activities for children, which otherwise would rather imposible ro do.

ilan zohar

Excelnt job. Wait for the nxt version for bluetooth support and genric I2C.

Warden Wei

Kin Fung Chu


hamed nozari

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!