Hi Guys ,
I just tested drive stepper motor with Aruino Nano and Arduino Uno V3+ CNC shield V3 but i found with same code , speed of motor when use with Arduino Uno V3 is so fast.
#include <SoftwareSerial.h>
SoftwareSerial BTSerial (0, 1);
const int StepX = 2;
const int DirX = 5;
const int StepY = 3;
const int DirY = 6;
const int En = 8 ;
String state;
void setup() {
Serial.begin(9600);
BTSerial.begin(9600);
pinMode(StepX, OUTPUT);
pinMode(DirX, OUTPUT);
pinMode(StepY, OUTPUT);
pinMode(DirY, OUTPUT);
pinMode(lstop , INPUT_PULLUP);
pinMode(En, OUTPUT);
digitalWrite(En, HIGH);
}
void loop() {
digitalWrite(DirX, HIGH);
digitalWrite(DirY, HIGH);
while (BTSerial.available() > 0) {
state = BTSerial.readString();
if (state == "Low_speed") {
digitalWrite(En, LOW);
run_step(2000);
run_step(2000);
digitalWrite(En, HIGH);
}
}
}
void run_step(int q) {
for(int i=0;i<10000;i++) {
digitalWrite(StepX , HIGH);
digitalWrite(StepY , HIGH);
delayMicroseconds(q);
digitalWrite(StepX , LOW);
digitalWrite(StepY , LOW);
delayMicroseconds(q);
}
}
When i use arduino Nano , delayMicroseconds(1000) is enough for low speed , but with Aduino Uno V3 , delayMicroseconds(6000) still make motor drive faster and make alot of vibration.
Please help me solve this issue , i need a low speed with low vibration when use Arduino V3 like that use Arduino Nano.
Thank so much

