why im always getting this error . help !!!!! "Expression or statement is incorrect--possibly unbalanced (, {, or [."

조회 수: 3 (최근 30일)
a = arduino('COM3','uno');
void step (boolean dir, byte dirPin, byte stepperPin, int steps)
{
digitalWrite (dirPin,dir);
delay (50);
for(int i=0; i<steps;i++)
{
digitalWrite (stepperPin, HIGH);
delayMicroseconds (800);
digitalWrite (stepperPin, LOW);
delayMicroseconds (800);
}
}
void setup ()
{
pinMode (X_DIR, OUTPUT);
pinMode (X_STP, OUTPUT);
pinMode (Y_DIR, OUTPUT);
pinMode (Y_STP, OUTPUT);
pinMode (Z_DIR, OUTPUT);
pinMode (Z_STP, OUTPUT);
pinMode (EN, OUTPUT);
digitalWrite (EN, LOW);
}
void loop ()
{
step (false, X_DIR, X_STP, 200);
step (false, Y_DIR, Y_STP, 200);
step (false, Z_DIR, Z_STP, 200);
delay (1000);
step (true, X_DIR, X_STP, 200);
step (true, Y_DIR, Y_STP, 200);
step (true, Z_DIR, Z_STP, 200);
delay (1000);
}
  댓글 수: 2
Madhu Govindarajan
Madhu Govindarajan 2017년 11월 16일
This looks like an arduino sketch and a MATLAB code at the same time. Could you tell us what you are trying to do and if you are using MATLAB support package for Arduino?
SYED AFDAR
SYED AFDAR 2017년 11월 16일
Hello mr madhu. I want to control 3 Steppers motors. So that i will have x,y and z axis. I'm using a4988 pololu as my Stepper motor shield. My project is doing on cnc machine. I use this code to only move motor as testing . But the error always coming out. Btw one more question can i make matlab as interface where it read gcode and make the machine work it. I'm using pololu a4988 shield. Please help me

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

답변 (0개)

카테고리

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