Help with Arduino code
#11
Me too! Tempted to fix an adult bev and chill.

It might be actually easier to try to add the keypad to Chuck F's sketch after all. But then, his sketch does things this old plonker doesn't understand as well...

Chuck
Micromark 7x14 Lathe, X2 Mill , old Green 4x6 bandsaw
The difficult takes me a while, the impossible takes a little longer.
Reply
Thanks given by:
#12
(04-05-2015, 10:09 AM)chucketn Wrote: Me too! Tempted to fix an adult bev and chill.

...

Chuck

That sounds like a good plan which I may copy.  5176

Ed
Reply
Thanks given by:
#13
(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.   Blush

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
Reply
Thanks given by:
#14
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.
Reply
Thanks given by:
#15
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

   
Reply
Thanks given by:
#16
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.
Logan 200, Index 40H Mill, Boyer-Shultz 612 Surface Grinder, HF 4x6 Bandsaw, a shear with no name, ...
the nobucks boutique etsy shop  |  the nobucks boutique
Reply
Thanks given by:
#17
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.
Reply
Thanks given by:
#18
(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
Reply
Thanks given by:
#19
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.
Logan 200, Index 40H Mill, Boyer-Shultz 612 Surface Grinder, HF 4x6 Bandsaw, a shear with no name, ...
the nobucks boutique etsy shop  |  the nobucks boutique
Reply
Thanks given by:
#20
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
Reply
Thanks given by:




Users browsing this thread: 4 Guest(s)