[PD] pd2stepper round II
Martin Peach
martin.peach at sympatico.ca
Thu Dec 28 01:35:25 CET 2006
alejo d wrote:
> yoo martin, thanks again, as said in my post, i have the stepper
> already under control via a ULN2003A driver and a potentiometer.
>
> im stuck in the pd part, no problems with comport or the serial but
> with the pd patch.
I don't have the patch here, it's at work, next week I go back...but
it's easy: you just send messages containing a single number though comport.
In your diagram you have the stepper on digital pins 8 9 10 11, which
are respectively decimal 256, 512, 1024 and 2048.
So if you wanted to turn pin 8 and 11 on, or example, you would send
256+2048:
[2304(
|
[comport]
So to do a complete sequence I did something like:
[metro 15]
|
[counter 3] -- this is a counter that goes from 0 to 3. There's no
standard counter in pd. It's useful to have one that can count backwards
as well.
|
[sel 0 1 2 3 ]
| | | |
[2560 ( [1536 ( [1280 ( [2304(
| | | | --All the messages
go to the single inlet of comport.
[comport]
Since there are only four possible patterns (1010, 0110, 0101, 1001),
it's just a question of changing the order of the four wires at the
output of the ULN2003A until the motor turns consistently in the same
direction.
Another issue is that you are feeding the motor 5V from the same power
supply as the arduino, which might cause trouble if the stepping of the
motor resets the microcontroller.
Usually it's better to have a separate power supply for the motor. Just
make sure to connect the two grounds together.
And in your photo, it looks like everything is powered from the USB,
which is virtually guaranteed not to work because the USB can't supply
enough current to drive a motor.
Martin
More information about the Pd-list
mailing list