11 years, 4 months ago.

how to use RPC to control stepper motor from matlab

Hi, I am trying to control a stepper motor from matlab. This motor is controlled by the mbed LPC1768 via the DM320c driver. Now, when I run the motor by uploading the code, it works fine. Now I want to control it from Matlab by using RPC. My c code is

  1. include "mbed.h"
  1. include "stepper.h"

stepper x(p10,p12);

int main()

{

while(1)

{

x.oneStep(1,0); }

}

and it works well on the mbed. How should I change it so that I can run this code in matlab such as by run the matlab code like this:

import mbed.*

mymbed = SerialRPC('COM5', 9600)

mymbed.reset;

Stepper_RPC = RPCFunction(mymbed, 'Stepper');

Stepper = Stepper_RPC.run;

mymbed.delete;

clear;

Why I can`t include stepper.h in my code?

posted by Fangxin Tan 21 May 2017
Be the first to answer this question.