how to communicate simulink with Arduino

18 次查看(过去 30 天)
I'm trying simulate a simple code but:
### Generating code into build folder: C:\Users\Emerson\Documents\matlab\untitled_grt_rtw
### Invoking Target Language Compiler on untitled.rtw
### Using System Target File: C:\Program Files\MATLAB\R2017a\rtw\c\grt\grt.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file untitled.h
### Writing header file untitled_types.h
### Writing source file untitled.c
.
### Writing header file rtwtypes.h
### Writing header file builtin_typeid_types.h
### Writing header file multiword_types.h
### Writing header file untitled_private.h
### Writing header file rtmodel.h
### Writing source file untitled_data.c
### Writing header file rt_nonfinite.h
.
### Writing source file rt_nonfinite.c
### Writing header file rtGetInf.h
### Writing source file rtGetInf.c
### Writing header file rtGetNaN.h
### Writing source file rtGetNaN.c
### TLC code generation complete.
### Using toolchain: LCC-win64 v2.4.1 | gmake (64-bit Windows)
### Creating 'C:\Users\Emerson\Documents\matlab\untitled_grt_rtw\untitled.mk' ...
### Building 'untitled': "C:\PROGRA~1\MATLAB\R2017a\bin\win64\gmake" -f untitled.mk all
C:\Users\Emerson\Documents\matlab\untitled_grt_rtw>set MATLAB=C:\Program Files\MATLAB\R2017a
C:\Users\Emerson\Documents\matlab\untitled_grt_rtw>cd .
C:\Users\Emerson\Documents\matlab\untitled_grt_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2017a\bin\win64\gmake" -f untitled.mk all ) else ("C:\PROGRA~1\MATLAB\R2017a\bin\win64\gmake" -f untitled.mk )
"C:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/bin/lcc64" -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/Users/Emerson/Documents/matlab -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include/sf_runtime -IC:/Users/Emerson/Documents/matlab/untitled_grt_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -Fo"rtGetInf.obj" "rtGetInf.c"
"C:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/bin/lcc64" -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/Users/Emerson/Documents/matlab -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include/sf_runtime -IC:/Users/Emerson/Documents/matlab/untitled_grt_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -Fo"rtGetNaN.obj" "rtGetNaN.c"
"C:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/bin/lcc64" -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/Users/Emerson/Documents/matlab -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include/sf_runtime -IC:/Users/Emerson/Documents/matlab/untitled_grt_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -Fo"rt_nonfinite.obj" "rt_nonfinite.c"
"C:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/bin/lcc64" -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/Users/Emerson/Documents/matlab -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include/sf_runtime -IC:/Users/Emerson/Documents/matlab/untitled_grt_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -Fo"untitled.obj" "untitled.c"
"C:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/bin/lcc64" -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/Users/Emerson/Documents/matlab -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include/sf_runtime -IC:/Users/Emerson/Documents/matlab/untitled_grt_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -Fo"untitled_data.obj" "untitled_data.c"
"C:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/bin/lcc64" -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/Users/Emerson/Documents/matlab -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include/sf_runtime -IC:/Users/Emerson/Documents/matlab/untitled_grt_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -Fo"rt_logging.obj" "C:\PROGRA~1\MATLAB\R2017a\rtw\c\src\rt_logging.c"
"C:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/bin/lcc64" -c -w -noregistrylookup -nodeclspec -IC:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/include64 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=0 -DMODEL=untitled -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/Users/Emerson/Documents/matlab -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include/sf_runtime -IC:/Users/Emerson/Documents/matlab/untitled_grt_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -Fo"rt_main.obj" "C:\PROGRA~1\MATLAB\R2017a\rtw\c\src\common\rt_main.c"
C:/PROGRA~1/MATLAB/R2017a/sys/perl/win32/bin/perl.exe C:/PROGRA~1/MATLAB/R2017a/rtw/c/tools/mkvc_lnk.pl untitled.lnk rtGetInf.obj rtGetNaN.obj rt_nonfinite.obj untitled.obj untitled_data.obj rt_logging.obj
"### Creating standalone executable "../untitled.exe" ..."
"C:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/bin/lcclnk64" -s -LC:/PROGRA~1/MATLAB/R2017a/sys/lcc64/lcc64/lib64 -o ../untitled.exe @untitled.lnk rt_main.obj
untitled.obj .text: undefined reference to 'writeDigitalPin'
untitled.obj .text: undefined reference to 'digitalIOSetup'
gmake: *** [../untitled.exe] Error 2
C:\Users\Emerson\Documents\matlab\untitled_grt_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\Users\Emerson\Documents\matlab\untitled_grt_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
### Build procedure for model: 'untitled' aborted due to an error.
Error(s) encountered while building "untitled":
### Failed to generate all binary outputs.
  3 个评论
Walter Roberson
Walter Roberson 2018-3-18
Could you confirm that the only way you are communicating with the Arduino is through the Digital Output block?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by