Service MotorDualPwm

I need to operate the platform on 4 DC motors. I want to use the service - MotorDualPwm. When setting the pin, RightPwmPin c is reset to 0. What is my error or is it an error in the program?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
GroG's picture

Are you setting it with a

Are you setting it with a python script ?
Did you send a noWorky ?

http://myrobotlab.org/content/helpful-myrobotlab-tips-and-tricks-0#noWorky

alexstarter's picture

No, I do not write a Python

No, I do not write a Python script, I use the MotorDualPwm service.
I did not send noWorky.

alexstarter's picture

I sent noWorky.

I sent noWorky.

alexstarter's picture

I used an example:

#########################################
# MotorDualPwm.py
# description: Motor service which support 2 pwr pwm pins clockwise and counterclockwise
# categories: motor
# more info @: http://myrobotlab.org/service/MotorDualPwm
#########################################
# Config
port="COM3"
# start optional virtual arduino service, used for test
if ('virtual' in globals() and virtual):
virtualArduino = Runtime.start("virtualArduino", "VirtualArduino")
virtualArduino.connect(port)
arduino = runtime.start("arduino","Arduino")
motor = runtime.start("motor","MotorDualPwm")
arduino.connect(port)
motor.setPwmPins(10,11)
motor.attach(arduino)
# At this point you should be able to control the motor thru the Gui
# move both motors forward
# at 50% power
# for 2 seconds
motor.move(0.5)
sleep(2)
# move both motors backward
# at 50% power
# for 2 seconds
motor.move(-0.5)
sleep(2)
# stop and lock
motor.stopAndLock()
# after locking
# motor should not move
motor.move(0.5)
sleep(2)
# unlock motor and move it
motor.unlock()
motor.move(0.5)
sleep(2)
motor.stop()

alexstarter's picture

I used an example:

 

Everything worked for me!