Hello guys, we have this code to drive stepper motor, we are trying to make a garage door that rotates 90 degrees. We have an analog load sensor and digital ultrasonic proximity sensor. We need to rotate stepper motor +90 degrees when the sensor is 1 or High and -90 degrees when the sensor is 0 or Low but we don't know how to get sensors output and integrate it. Motor : 28BYJ48 Driver board: ULN2003A
#include <Stepper.h>
int motorPin1 =8;
int motorPin2=9;
int motorPin3=10;
int motorPin4=11;
#define ADIM 128
Stepper stepKontrol (ADIM, motorPin1, motorPin3, motorPin2, motorPin4);
int adimSayisi;
void setup() {
stepKontrol.setSpeed(400);
}
void loop()
{
stepKontrol.setSpeed(200);
adimSayisi= 512;
stepKontrol.step(-512);
stepKontrol.setSpeed(400);
adimSayisi=-128;
delay(1500);
}