color sorting
17 year
Hi steven,

first i would like to RR is a great piece of software. I am currently using in my image processing class. But my students ran into some problems  in their project which uses the roborealm to sort 3 (R,G and B) colours by controlling a stepper motor via the parallel port.  

As you might know for the stepper to work it must be pulsed form the parallel port (switch the pin on and off) this can be accomplished. But the problem is i cant control the number of pulses which is usually done in loops.

Example let say i detect red color the motor should rotate 30 steps and stop. I have tried to create a counter with vbs but the counter doesnt stop or increase sometimes. im having problem with the getVariable and set variable instruction for vbs.

Hope you can help me out.

Parallel Stepper
17 year

You had the right idea but you have to imagine that the entire processing pipeline is already in a neverending loop. Thus to get a stepper to step 300 times you need to use the If statements to check what state you are in. We've included a robo-file that we think does what you've requested.

Note the use of "rot" to determine if you are in rotation mode or not. When you are "rotating" you don't care about any new red object in the image and are just performing the rotation using the parallel port. Thus the first conditional will execute for as long as "rot" is non-zero ... this will happen for 300 cycles until "rot" is zero. Your version does use the set and get variable routines correctly ... you were just setting rot=300 every time the processing pipeline was executing and thus not seeing rot decrease.

The second conditional is where the red object is detected. Once it is detected then rot is set to 300 which on the next iteration will cause the first block of code that communicates with the parallel port to run ...

Note that you also had two parallel port modules in your version. This will probably not work and cause very confusing signals on your parallel port.

Also note the use of Timer in the first conditional block. This can be used to slow the change of rot and thus slow the frequency of bit changes on the parallel port. We set it to 100 milliseconds ... not sure if that is the frequency of your stepper motor.

Give the attached robo-file a try and let us know how it goes.



This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index