Posts: 8,888
Threads: 320
Joined: Feb 2012
Location: Arizona/Minnesota
(04-05-2015, 09:57 AM)EdK Wrote: That information helps Chuck.
Looking at the code:
The rotation function gets passed a negative number via ToMove.
The rotation function:
has a "for" loop who's counter is compared to that negative number. I don't think the counter will ever be less than that negative number so the loop won't ever run. I think Arvid needs to verify that since it makes my brain hurt.
Ed
Never mind what I posted above. I see the error of my ways. This code snippet does indeed give you a positive number which is passed to the rotation function.
Code:
if(Degrees < 0)
{
ToMove = (Degrees*Multiplier)*-1;
I'll keep digging when I have a chance.
Ed
Posts: 375
Threads: 53
Joined: Jun 2013
Location: Jonesborough, TN
Thanks, Ed. Whish I had someone close that understood this stuff and could explain it to me.
A programming manual is great, but if there's not enough examples to use and try, it doesn't help.
Just spent an hour trying to get the keypad to input a # and display it. I copied the keypad stuff from the sketch in question, as I have that part right, and make it display an input. No go.
Chuck
Micromark 7x14 Lathe, X2 Mill , old Green 4x6 bandsaw
The difficult takes me a while, the impossible takes a little longer.
Posts: 8,888
Threads: 320
Joined: Feb 2012
Location: Arizona/Minnesota
Chuck,
I stripped out all of the LCD and keypad stuff from the sketch so I could run it and I have it stepping in both directions. The bottom trace is the direction and the top the step signal. At least the pins are doing what they're supposed to.
Ed
Posts: 2,629
Threads: 101
Joined: Dec 2014
Location: Michigan
Now that we know that, Chuck can you put a scope or voltmeter on the direction pin on the arduino to see if it's actually going low? I'm thinking the stepper driver may be holding the output high.
Posts: 375
Threads: 53
Joined: Jun 2013
Location: Jonesborough, TN
I can put a volt meter on it, don't have a scope. Will do that in the morning.
I don't understand how the driver can hold an input high. Putting a ground on the input causes direction to change.
Chuck
Micromark 7x14 Lathe, X2 Mill , old Green 4x6 bandsaw
The difficult takes me a while, the impossible takes a little longer.
Posts: 8,888
Threads: 320
Joined: Feb 2012
Location: Arizona/Minnesota
(04-05-2015, 06:22 PM)chucketn Wrote: I can put a volt meter on it, don't have a scope. Will do that in the morning.
I don't understand how the driver can hold an input high. Putting a ground on the input causes direction to change.
Chuck
I don't believe it's a hardware problem. Something in the software is not doing what it''s expected to do. I'll keep digging.
Ed
Posts: 2,629
Threads: 101
Joined: Dec 2014
Location: Michigan
If on the odd chance the driver has more pull up on it than the arduino has pull down. Or maybe the arduino isn't pulling it down far enough.
Posts: 8,888
Threads: 320
Joined: Feb 2012
Location: Arizona/Minnesota
Given that he's tried two different Arduino pins into the direction pin, I doubt it's hardware. The Arduino has plenty of drive power so that shouldn't be an issue. It's still worth measuring the voltage on the direction pin though just to give us another point of information.
Ed