Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How to connect and control a stepper motor and sensor connected to laptop using matlab?

Asked by Kevin on 22 Nov 2012

I have a stepper motor with driver and a through beam sensor, when an object passed my sensor I would like my program to run and the motor will also run by 90 degrees counterclockwise then after the object passed the second sensor my motor will turn clockwise again by 90 degrees. can anyone help me how to connect this using parallel port and the code for it? Thank you very much hope someone helps


Walter Roberson on 22 Nov 2012

Which operating system and MATLAB version are you using, and are you using 32 bit or 64 bit MATLAB?

Newer versions of MS Windows have made it technically difficult and slow to access the parallel port. It is recommended that you do not start any new projects using the parallel port.

Kevin on 24 Nov 2012

I have windows xp with Matlab 2010, I am also running it in 32 bit.



No products are associated with this question.

1 Answer

Answer by Walter Roberson on 24 Nov 2012


Walter Roberson on 1 Dec 2012

There is an arduino package in the File Exchange that can be used for older MATLAB. Very new MATLAB (or is it Simulink?) have support for arduino built-in.

Kevin on 1 Dec 2012

Thank you I think I have downloaded that arduino package. I think it will be safer than having the sensor input enter the laptop directly

Kevin on 28 Jan 2013

hey man, I tried the arduino package and it says timeout error, c an you help me fix this?

Walter Roberson

Contact us