PBASIC problem

I started programming today. Two motors work on pin 1 and 2 off of port 1 and 2 joysticks on the y-axis. So, each joystick is running one motor on its y-axis.

What I want to do is have a drive train with 4 motors. How can I made 4 motors run on only y-axis of two joysticks, i.e. two motors on y-axis of each joystick

Thanx
Punar

Basically, just set a speed controller on each motor, and send the same value to both of the left motors, and the same signal to both of the right motors

Download the default program from the Innovation First site and edit it to output p1_y and p2_y to two more PWMs. So if you hook up your other two motors to PWM3 and PWM4, your serout command would be:

``````Serout USERCPU, OUTBAUD, [255,255,p1_y,relayA,p2_y,relayB,p1_y,p2_y,p1_x,p2_x,p3_x,p4_x,p1_wheel,p2_wheel,p3_wheel,p4_wheel,127,127,127,127]
``````

*Originally posted by punarhero *
**I started programming today. Two motors work on pin 1 and 2 off of port 1 and 2 joysticks on the y-axis. So, each joystick is running one motor on its y-axis.

What I want to do is have a drive train with 4 motors. How can I made 4 motors run on only y-axis of two joysticks, i.e. two motors on y-axis of each joystick

Thanx
Punar **

Did you connect a motor to PWM

# 5 ? This is the default program’s output for the x axis of the Port 1 joystick, and quite helpful for turning, in one-stick “tank” steering (look into it on the Innov’n First Board).

um. y-splitter. Hook up the left motors to independent victors, then attach the victors to a y-splitter and then put the other end to pwm1. do the same on the right with pwm2. its the simplest method.

*Originally posted by Joseph F *
**um. y-splitter. Hook up the left motors to independent victors, then attach the victors to a y-splitter and then put the other end to pwm1. do the same on the right with pwm2. its the simplest method. **

If I remember correctly, splitting a signal to two speed controllers is pushing the limits of the power supplied on the PWM

signal for the speed controller’s optocoupler. Technically, it can be done, but personally, I’d say play it safe and give each speed controller to its own set of pins.

I am pretty sure that a Y on a PWM cable is just fine.

Joe J.

There are definantly several different ways to solve this problem.

Mechanically:
You could run a chain from one motor to drive two wheels on one side.

Electronically:
You could use the Y splitters from one PWM output to go to two different speed controllers (each controlling a different motor)

Softwar(ly?):
The “Serout” command at the end of the default code is what sends out the signals to all the electronics. You could simply connect each motor’s speed controller to its own PWM output. (Let’s suppose the motors on PWM 1 and PWM 2 are the two motors you want to run simultaneously from one joystick [plugged into port1], and PWM 3 & 4 from the other joystick [plugged into port 2])
You could change the output line from:
Serout USERCPU, OUTBAUD, 255,255,p1_y,relayA,p2_y,relayB,p3_y,p4_y,… (etc)
to:
Serout USERCPU, OUTBAUD, 255,255,p1_y,relayA,p1_y,relayB,p2_y,p2_y,…(etc)

Or

you could leave the output line alone and simply add, right before the Serout command:
p4_y = p2_y 'This makes PWM 4’s output be controlled by Port 2’s joystick (y-axis)
p3_y = p2_y 'This makes PWM 3’s output be controlled by Port 2’s joystick
p2_y = p1_y 'This makes PWM 2’s output be controlled by Port 1’s joystick

’ Default program’s comment code…
’ blah blah blah

Serout USERCPU, OUTBAUD, 255,255,p1_y,relayA,p2_y,relayB,p3_y,p4_y,…(etc)

Whatever method is best for you, go for it