Hi, I'm a beginner with arduino and I'm trying my best! Today I started to move a stepper motor with a driver on it, I finally succeeded, I didn't find tutorials on the net, so I'll try to get involved! Now I'm trying to move a 4118S-08P-01RO-LP stepper motor with an LCDA86H driver and of course, an arduino uno. I managed to connect it, move it a little, but I'd like it to stop when I touch the magnetic sensor, it's it's a Panasonic GH-H6B sensor. I can't understand how to adjust the engine speed and how to make it stop when it reaches the end of the stroke.
I came here after many attempts:
<const int senzor=7;
void setup(){
Serial.begin(9600);
pinMode(dirPin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(endPin, OUTPUT);
digitalWrite(endPin, LOW);
}
void loop(){
int senzor1stare=digitalRead(senzor);
if(senzor1stare==HIGH){
delay(5);
}
if(senzor1stare==LOW){
for(int x=0;x<800;x++){
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
}
}>
With this sensor,how if works?it's something like ==0/1 or ==HIGH/LOW?
Regards,Alex.