Need some help understanding a few things.
TC
Posts: 1,019
Hello all, I have hit a roadblock with my 3D printer project. I am having trouble understanding how the prop keep track of time, how long it takes to do something, how I can calculate a pulse. Most of all, understanding how timing works in general.
And for my 3D printer, it just has to move in a straight line. I found Bresenhams line algorithm but I cant understand how it works, or how to make it work with the prop. I found countless examples in C, C++, and in Java, but I have never used or worked with them.
I was wondering if someone would please help me out, and help me understand these problems?
And for my 3D printer, it just has to move in a straight line. I found Bresenhams line algorithm but I cant understand how it works, or how to make it work with the prop. I found countless examples in C, C++, and in Java, but I have never used or worked with them.
I was wondering if someone would please help me out, and help me understand these problems?
Comments
Bresenham is just a special case of an algorithm called a digital differential analyzer: http://en.wikipedia.org/wiki/Digital_differential_analyzer_(graphics_algorithm)
The cool part of Bresenham is that is does all the math with integers. There are lots of explanations of how it works online. The one on Wikipedia is pretty good - Once you read the page I linked above, follow the link on it to the Bresenham description and work through it slowly.
To move a pair of steppers in time, you'll have to figure out how fast you want them to move, then figure out which one has the farthest to go. That's your long axis. Send a single motor pulse to that motor for every Bresenham loop iteration. Every time the other axis (the short one) would increment and reset the error term, take a step on the smaller axis.
Looking at your code, I am starting to understand it better. I do have one question, What is "mode" for?
I tried that, but I have a major problem understanding math problems. that is why I need the help, I want to understand them better.
In that program a pixel has three possible modes: 0 (off), 1 (on), or 2 (xor) -- that's not applicable to your motor movement requirements.
So would that be every time the hub comes back to start?
For example;
CNT = 0
cog1
cog2
cog3
cog4
cog5
cog6
cog7
cog8
CNT=1
Oh, Ok thank you.