Shop OBEX P1 Docs P2 Docs Learn Events
motor mind b enhanced help — Parallax Forums

motor mind b enhanced help

ccc11223ccc11223 Posts: 10
edited 2011-05-09 08:00 in BASIC Stamp
i just got a mmbe, and have never used the serin and serout commands before. i understand the concept of duty cycle, but all of the $## is confusing me. i simply need to make a dc motor run at full speed forward, and full speed backward. if someone could help me out by giving some example code it would be greatly appreciated.

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-05-09 08:00
    Each SEROUT to the MMBE must start with a $55.
    A $55 is ASCII for a 'U'.
    HEX isn't necessary.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    
    ' motormindexp.bs2
    '
    up_down:
      SEROUT 0, 396, ("U", 3, 255)   ' full on
      PAUSE 2500
    
      SEROUT 0, 396, ("U", 3, 128)   ' 1/2spd
      PAUSE 2500
    
      SEROUT 0, 396, ("U", 3, 0)     ' lowest
      PAUSE 500
    
      SEROUT 0, 396, ("U", 3, 1)     ' change dir
      SEROUT 0, 396, ("U", 3, 64)    ' 1/4spd
      SEROUT 0, 396, ("U", 3, 0)     ' lowest
      PAUSE 500
      SEROUT 0, 396, ("U", 3, 1)     ' change dir
    
      GOTO up_down
    

    Post Edit -- > 2 days later and no follow up. Oh well.
Sign In or Register to comment.