Hi everyone, I'm creating a little project using arduino uno with the cnc shield and I'm not using grbl library, I'm just letting the stepper motor run freely but I need to use a botton, if I push it the motor stop and when I stop pushing it the stepper will continue running, Now I just want to know if I can put for example D9 as a digital reader to do that, because I don't know if it can cause any damage to the shield or to the driver since the shield is using that digital pin.
You can see the code if you want
#define STEP 4 // pin STEP de A4988 a pin 4
#define DIR 7 // pin DIR de A4988 a pin 5
#define ENBL 8 // pin DIR de A4988 a pin 8
int retardo = 1000;
void setup() {
// put your setup code here, to run once:
pinMode(STEP, OUTPUT); // pin 4 como salida
pinMode(DIR, OUTPUT); // pin 5 como salida
pinMode(ENBL, OUTPUT); // pin 5 como salida
}
void loop() {
giro(STEP,DIR,ENBL); // put your main code here, to run repeatedly:
}
void giro(int paso_,int dire_,int habi_) {
digitalWrite(habi_, LOW); // Habilita el Driver
digitalWrite(dire_, LOW); // direccion de giro 1
// for(int i=0;i<tiempo;i++){ // da pasos por un tiempo
digitalWrite(paso_, HIGH);
delayMicroseconds(retardo);
digitalWrite(paso_, LOW);
delayMicroseconds(retardo);
}
Thank you