Hello Im having a bit of trouble lining up two square pulses on my oscilloscope the top one in the purple should drop at the same time as the yellow but there is a delay. I'm pretty new to arduino and I'm still working on my skills.
int speedPin = 10;
int upIn2 = 9;
int v = 0;
void setup()
{
// put your setup code here, to run once:
pinMode(speedPin, OUTPUT);
digitalWrite(speedPin, LOW);
pinMode(upIn2, OUTPUT);
digitalWrite(upIn2, LOW); // Low for now but will need to be used to go in reverse direction
//pinMode(enablePin, OUTPUT);
//digitalWrite(enablePin, HIGH);
}
void loop()
{
//digitalWrite(upIn2, LOW);
while(v<1) //setting number of overall trials
{
v++;
digitalWrite(upIn2, HIGH);
for(int i = 0; i<=0; i++) //loop to increment 10 pulses forward
{
digitalWrite(speedPin, HIGH); //Pulse width of 3 s
delay(90);
digitalWrite(speedPin,LOW); //off width of 4 s
delay(40);
digitalWrite(upIn2, LOW);
//digitalWrite(enablePin,HIGH); //remains High while running the loop
}
}
digitalWrite(upIn2, LOW);
digitalWrite(speedPin, LOW);
//digitalWrite(enablePin, LOW);
}