Controlling Nanotec N5 motor controller using matlab webread and webwrite commands

조회 수: 1 (최근 30일)
I am using Nanotec N5 motor controller that is shipped with a built in web interface called NanoIP.
Using this interface I can query data from the controller object dictionary using webread. For example
>> webread('http://169.254.58.57/od/6060/00')
ans =
02
Now I would like to write values as well, however, each time I try I fail and get an error messages. For example if I input the data as characters:
>> webwrite('http://169.254.58.57/od/6060/00','01')
I get this error:
Error using readContentFromWebService (line 45)
The server returned the status 400 with message "BAD REQUEST" in response to the request to URL http://169.254.58.57/od/6060/00.
Error in webwrite (line 132)
[varargout{1:nargout}] = readContentFromWebService(connection, options);
and if I input data as numbers:
>> webwrite('http://169.254.58.57/od/6060/00',1)
I get this error:
Error using webwrite (line 126)
The media type 'application/x-www-form-urlencoded' is not permissible for numeric or logical data.
Am I doing something wrong here? Should I use different data type?

답변 (1개)

Mohammad Moataz
Mohammad Moataz 2019년 1월 28일
Ok, It turned out that I should have added extra double qoutes when passing a value to Nanotec controller using webwrite command. example:
>> webwrite('http://169.254.58.57/od/6060/00','"01"')
Now it works.
  댓글 수: 2
Chris
Chris 2020년 12월 2일
Hello,
firstly thanks for your information’s! They are really helpful for me! I use the Nanotec controller N5-2-3 and the function "webread" works fine but for "webwrite" I always get an error "Time out after 5 seconds". I try a lot of things e.g. change the header but the problem still existed. May you have an idea?
Thanks a lost!
Mohammad Moataz
Mohammad Moataz 2020년 12월 2일
I didn't face such error, but I believe it might be something with connections or its configuration (not with Matlab). In my case I was connecting to the controller using ethernet cable which works as both input and output. I don't remember the configurations now as this was 2 years ago. You can also try to manually write values from your web browser to make sure it is possible. I hope you can figure it out.

댓글을 달려면 로그인하십시오.

커뮤니티

더 많은 답변 보기:  Power Electronics Community

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by