Shop OBEX P1 Docs P2 Docs Learn Events
Not Sure Where to Start — Parallax Forums

Not Sure Where to Start

coleasterlingcoleasterling Posts: 2
edited 2007-08-07 22:06 in General Discussion
So here's the idea:

I need to control two fairly beefy steppers on 12v with a bs2. I have the hardware choices down(I think) but I don't really know where to start on the programming side.

Basically I need to be able to run 7 different "programs" with two actions in them at the push of 7 different switches, or 2 switches, which would run the programs sequentially(haven't decided on that yet). Each program has to move motor 1 to a precise spot, then move motor 2 to a precise spot. This position will hold until another switch is depressed. When this happens the action will reverse itself to zero the motors, then move the steppers to their new positions. Motor 1 will not move at all a few of the programs. All switches are momentary.

So it works like this if switches are pressed sequentially(motors start at 0):

Switch 1:
Program 0: m1 to 0, m2 to 0

Program 1: m1 to -45degrees(or however many steps ccw) then m2 to 10degrees and hold

Switch 2:
Reverse of Program 1: m2 to 0, then m1 to 0

Program 2: m1 to 45degrees, then m2 -10degrees

Switch 3:
Reverse of Program 2: m2 to 0, then m1 to 0

Program 3: m1 hold(no movement), m2 10degrees

Switch 4:
Reverse of Program 3: m2 to 0

Program 4: m1 hold then m2 to 10 degrees

I think you get the idea....The motors will always go to one of 3 values. In this case m1 goes either -45(45ccw), 0, or 45(cw). M2 goes to either -10(10ccw), 0, or 10(cw). The motors always do the actions in pairs. I use the term program loosely...just as a classification for a certain pair of actions. I am thinking now I will have to just do this sequentially because then the program gets very complex say if you want to go from switch(or postion) 1 to 5 or 5 to 1.

Basically I have no clue where to start this program. I want to start off with just using 2 switches and having to go through sequentially, then later on move to being able to do each position in any order. I hope this makes sense. If someone can point me in the right direction on how to do this I'm sure I can figure it out after that.
Thanks,
Cole

Comments

Sign In or Register to comment.