Shop OBEX P1 Docs P2 Docs Learn Events
Pololu Micro dual serial motor controller Help — Parallax Forums

Pololu Micro dual serial motor controller Help

vla7vla7 Posts: 79
edited 2007-12-08 02:04 in BASIC Stamp
I've been having alot of problems with this little motor controller.· The current problem is that when I try to run·a program, it wants to run it twice.· For example when I enter this simple to program that should turn on motor 1 for one second then turn on motor two for one second, it always does it twice.· Can someone please tell me what I'm doing wrong?

' {$STAMP BS2}
HIGH 14
LOW 15
HIGH 15
PAUSE 100
SEROUT 14,32,[noparse][[/noparse]$80,0,2,127]
PAUSE 1000
SEROUT 14,32,[noparse][[/noparse]$80,0,2,0]
PAUSE 1000
SEROUT 14,32,[noparse][[/noparse]$80,0,0,127]
PAUSE 1000
SEROUT 14,32,[noparse][[/noparse]$80,0,0,0]
PAUSE 1000
END

I'd appreciate any insight into using Pololu's micro dual serial motor controller.

Comments

  • Steve JoblinSteve Joblin Posts: 784
    edited 2007-12-08 02:04
    hmmmm... I've sometimes had some weird behaviors with mine... as a rule of practice, I always start by making sure my stamp "warms up" a bit by issuing a "pause 100" command, then I like to ensure that the Pololu has the Default Configuration by issuing a SEROUT X,32,[noparse][[/noparse]$80,2,2] (where x is the pin you are using), followed by a "reset" by bringing the the line low for 10 ms, then high again.

    Your code should look something like this:

    SPEED VAR Byte
    RESET_DSMC CON 3
    Counter VAR Word

    DEBUG CLS
    DEBUG "Reset Controller", CR

    FOR counter= 2000 TO 4000 STEP 200
    FREQOUT 7, counter/50, counter
    NEXT

    ' Set Default Configuration for DSMC
    SEROUT 4,32,[noparse][[/noparse]$80,2,2]
    PAUSE 10

    ' Reset DSMC
    LOW RESET_DSMC
    PAUSE 10
    HIGH RESET_DSMC
    PAUSE 100

    'Start of tests

    DEBUG "Ramp Up Right Motor Forward", CR
    FOR SPEED = 0 TO 127 STEP 5
    SEROUT 4,32,[noparse][[/noparse]$80,0,0,SPEED]
    PAUSE 50
    NEXT

    DEBUG "Ramp Down Right Motor Forward", CR
    FOR SPEED = 127 TO 0 STEP 5
    SEROUT 4,32,[noparse][[/noparse]$80,0,0,SPEED]
    PAUSE 50
    NEXT

    PAUSE 1000

    DEBUG "Ramp Up Right Motor Reverse", CR
    FOR SPEED = 0 TO 127 STEP 5
    SEROUT 4,32,[noparse][[/noparse]$80,0,1,SPEED]
    PAUSE 50
    NEXT

    DEBUG "Ramp Down Right Motors Reverse", CR
    FOR SPEED = 127 TO 0 STEP 5
    SEROUT 4,32,[noparse][[/noparse]$80,0,1,SPEED]
    PAUSE 50
    NEXT

    PAUSE 1000

    DEBUG "Ramp Up Left Motor Forward", CR
    FOR SPEED = 0 TO 127 STEP 5
    SEROUT 4,32,[noparse][[/noparse]$80,0,2,SPEED]
    PAUSE 50
    NEXT

    DEBUG "Ramp Down Left Motor Forward", CR
    FOR SPEED = 127 TO 0 STEP 5
    SEROUT 4,32,[noparse][[/noparse]$80,0,2,SPEED]
    PAUSE 50
    NEXT

    PAUSE 1000

    DEBUG "Ramp Up Left Motor Reverse", CR
    FOR SPEED = 0 TO 127 STEP 5
    SEROUT 4,32,[noparse][[/noparse]$80,0,3,SPEED]
    PAUSE 50
    NEXT

    DEBUG "Ramp Down Left Motors Reverse", CR
    FOR SPEED = 127 TO 0 STEP 5
    SEROUT 4,32,[noparse][[/noparse]$80,0,3,SPEED]
    PAUSE 50
    NEXT

    PAUSE 1000
Sign In or Register to comment.