How can I control a stepper motor (in arduino) with matlab?

조회 수: 20 (최근 30일)
Gianmarco
Gianmarco 2013년 11월 12일
댓글: Lorenzo Lellini 2022년 12월 15일
Hi, I connected a stepper motor to arduino and this is the example script that I used:
include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);
void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}
How can I 'translate' this script in matlab code? My problem is that I want to control the rotation of the stepper depending on a value computed in matlab, so should be great if I could control the stepper motor directly with matlab. I saw that already exists 'ARDUINO I\O Package' but that works only with arduino motor shield but I have 'ARDUINO UNO'. Can anyone help me please?
  댓글 수: 2
Shubham Shah
Shubham Shah 2016년 9월 27일
I have the exact same problem...!! #Gianmarco did you find out how to do this yet ? if you have tell me please.
Lorenzo Lellini
Lorenzo Lellini 2022년 12월 15일
Did you find a way to control it with Arduino?
I mean also to control speed and other stepper library parameters and not just the pins.

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

답변 (1개)

BRITISH ASHOK
BRITISH ASHOK 2020년 2월 24일

커뮤니티

더 많은 답변 보기:  Power Electronics Community

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by