matlabuser-interfacematlab-figurematlab-guidegui-designer

Animating a turntable using Matlab's GUIDE


I have an application where I have a stepper motor connected to a turntable. The stepper motor's driver is controlled serially via Matlab.That is, I can control the angle through which the stepper motor turns the turntable and the speed at which it is happening by sending data to the stepper motor using a serial port in Matlab. Once the stepper motor turns by the required angle, it returns its current angle back to another serial port.

I am trying to build a GUI where the user can input the speed and the angle to which the turntable must be turned.I want to be able to illustrate the rotation of the turntable on my GUI itself, using the data about the current angle that the stepper motor returns to me.

Can anyone suggest a good way to creat and animate the turntable's rotation using MATLAB's GUIDE? The animated figure must be able to display the current angle with its initial reference angle. What I have in mind looks like the figure below.

Turntable with reference line and rotating line


Solution

  • Just plot eveything with lines and update the lines accordingly, don't be afraid to start using some math to calculate the angles and line end points, and to plot the circles. This is something pretty easy to do.