Shop OBEX P1 Docs P2 Docs Learn Events
PropellerRobotControlerBoard + PWM with 2 Motors — Parallax Forums

PropellerRobotControlerBoard + PWM with 2 Motors

nomadnomad Posts: 276
edited 2010-04-28 03:14 in Propeller 1
Ref: PRCBoard + PWM························
hi,
i have a chassis with 2 motors and the PRCB and 12volt Battery
and i want drive this two motors with PWM (PWM_32_v2.spin)
the original-code is from botdocter as attachmend-file.
now today i make first a little test with this code
forward-movements are ok but...
- backward (reverse)
- leftTurn
- rightTurn
dont work??? nothing moves and i dont know what i should do
few questions:
1) is this correct:
 - interns Pins are
    - LeftMotor MOT_A
      - chipPin P24,P25:
      - outa[noparse][[/noparse]24] := 0  Left Motor Stop   
      - outa[noparse][[/noparse]24] := 1  Left Motor Reverse     
      - outa[noparse][[/noparse]25] := 0  Left Motor Stop   
      - outa[noparse][[/noparse]25] := 1  Left Motor Forward

    - RightMotor MOT_B
      - chipPin P26,P27:
        - outa[noparse][[/noparse]26] := 0 ' Right Motor Stop 
        - outa[noparse][[/noparse]26] := 1 ' Right Motor Forward
        - outa[noparse][[/noparse]27] := 0 ' Right Motor Stop 
        - outa[noparse][[/noparse]27] := 1 ' Right Motor Reverse

here some code snippets what i mean, is this correct???
2) Forward:
   - leftMotor:
     - PWM.Duty(25,50,16_665) '
   - rightMotor
     - PWM.Duty(26,50,16_665) 
3) Stop
   - leftMotor:
     - PWM.Duty(25,0,16_665)
   - rightMotor:
     - PWM.Duty(26,0,16_665)
4) LeftTurn (lefMot = reverse, rightMot = forward
   - leftMot:
     - PWM.Duty(24,50,16_665) ' reverse leftMot
   - rightMot:
     - PWM.Duty(26,50,16_665) ' forward rightMot
5) RightTurn (leftMot = forward, righMot = reverse
   - leftMot:     
     - PWM.Duty(25,50,16_665) ' forward leftMot
   - rightMot
     - PWM.Duty(27,50,16_665) ' reverse rightMot
6) Backward
   - leftMot:
     - PWM.Duty(24,50,16_665)
   - rightMot:
     - PWM.Duty(27,50,16_665)                

I think, if i change the directions, i must make stop for the motors before i take a
another directions ?
for help, hints and tips is appreciated
regards nomad
·
································································

Post Edited (nomad) : 4/28/2010 7:29:41 AM GMT

Comments

  • BotdocterBotdocter Posts: 271
    edited 2010-04-28 03:14
    Do you have a ping))) sensor attached?

    If yes:

    You should write the code as in the example in the top of the file.
    it is something like:

    IF range < 30 'cm
    Turnleft
    or turnright or whatever

    so you need the sensor input to make it do something.


    If you want to drive the robot by remote, that's another thing. I don't know much about, but there should be enough on the forum. Also i believe the Stingray demo code( with ping))) ) has code build in for the remote. Just google for it.

    If you need any more help i need some more information like wat you exactly want the bot to do.

    Botdoctor,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1 Parallax Propeller Robot Control Board
    1 Memsic MX2125 accelerometer/ tilt
    1 Parallax Ping))) ultrasonic sensor

    a few motors and a whole lot of chaos!
Sign In or Register to comment.