S-function for reading the Lego NXT compass sensor
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi!
My question is about using the NXT Toolbox in simulink. Since there is no built in block for reading the compass sensor, I would like to write an S-function containing C-code with libraries from nxtOSEK (ecrobot_interface.h mainly), which have methods for reading the compass sensor. I have tried using the s-function builder as well as writing the c-file manually from a template, and also the Code Legacy Tool. None of these manages to compile the c-code. I get lots of (>100) syntax errors in library files not written by me, for example:
C:\Matlab\R2012a\targets\nxtOSEK\lejos_nxj\src\nxtvm\javavm\classes.h(70) : error C2143: syntax error : missing ')' before '('
Is there something special I need to think about when using external libraries in C mex S-functions?
regards, Fredrik
댓글 수: 0
채택된 답변
Kaustubha Govind
2012년 6월 8일
You just need to make sure to have all the right #includes and use the right compiler/linker flags. Pretty much what you might need to do if you were trying to create a standalone application with that code outside of MATLAB.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 LEGO MINDSTORMS EV3 Hardware에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!