Yes, definitely put in some Serial.print statements to display the values of direct and pulseDelay inside the loop. That'll slow down the motor (which will get the pulse commands slower) but it'll help see what the controls are doing (if anything).
Anything seems possible when you don't know what you're talking about.
This is what I am seeing:
1394 2
1392 2
1330 2
1444 2
1284 2
1465 2
1301 2
1423 2
1354 2
1356 2
1410 2
1303 2
1457 2
1288 2
1452 2
1330 2
1402 2
1392 2
1337 2
1444 2
1293 2
1471 2
1301 2
1434 2
1352 2
1370 2
1411 2
pulseDelay = map(analogRead(revPin),0,1023,2000,50);
digitalWrite(dirPin,direct); // Set direction
Serial.print(pulseDelay,DEC); // prints a tab
Serial.print("\t"); // prints a tab
Serial.print(dirPin,DEC);
Serial.print("\t"); // prints a tab
Serial.println(); // carriage return after the last label
Very strange. Please show me your wiring for both the switch and the pot.
Also, you'll need to use at least a 5K linear potentiometer.
Can you run that test again while turning the pot through its entire range and back please ? I want to see what effect changing the pot has over its whole range.
Anything seems possible when you don't know what you're talking about.
I was turning the pot and pushing the button but neither seemed to effect the motor.
Ralph
This is what I am seeing:
pulseDelay = map(analogRead(revPin),0,1023,2000,50);
My error, that should read
pulseDelay = map(analogRead(spdPin),0,1023,2000,50);
i.e. AnalogRead(spdPin) not revPin.
Anything seems possible when you don't know what you're talking about.
Should lastInt = millis(); show a value for lastInt?
Serial.print(lastInt,DEC); shows nothing.
Ralph
try Serial.println(lastInt);
Anything seems possible when you don't know what you're talking about.
I corrected the spdPin error.
Here is video of the motor turning:
Turn up your speaker volume to hear the motor.
Ralph
Serial.println(lastInt); still shows 0
Ralph
I corrected the spdPin error.
Here is video of the motor turning:
Good, then we're making at least some progress 🙂
Is your switch reversing properly ? You'll need to look up what pins on your Arduino are interruptible and use one of those. I chose pin 5 for use but it may not be appropriate for your Arduino model.
Bt the way, please use the Reply icon at the bottom of the message box. That sends me an email telling me that I have a reply, otherwise I just check randomly depending on which computer I'm using for what.
Anything seems possible when you don't know what you're talking about.
What model Arduino are you using and how is your switch wired ?
What level of micro stepping are you using ?
Anything seems possible when you don't know what you're talking about.
I am using a Adafruit Metro, which I believe is 386 based so it should have a lot more interrupt pins.
I cannot find any documentation on which pins are interrupt enabled.
I am using a Momentary On/Off switch.
Ralph
Which Metro ? Mini, M4, M0, ... ?
How is your switch wired (to what pins are the ends connected) ?
What level of micro stepping are you using ?
Anything seems possible when you don't know what you're talking about.
I am using a Adafruit Metro
So, back a couple of days ago, when I asked you "Which part of your setup doesn't exactly match Bill's setup ?", it didn't occur to you to mention that you weren't using an Arduino ????
Anything seems possible when you don't know what you're talking about.