The PWM1,2,3,4 that you're using need to be declare just like we declared "emergency_stop" in an earlier post.
Looking at the default code I'm guessing you started with, I spoke too quickly about not needing to change the Serout command. You don't have to change it, but you might want to so that it's clearer.
---------------
In the default code you're using, the "PWM" variables don't really exist.
PWMx is used only in comments and have not been declared. (comment lines start with a ').
These two lines are at the bottom:
Code:
' Serout USERCPU, OUTBAUD, [255,255,(PWM1),relayA,(PWM2),relayB,(PWM3),(PWM4),(PWM5),(PWM6),(PWM7),(PWM8),(PWM9),(PWM10),(PWM11),(PWM12),(PWM13),(PWM14),(PWM15),(PWM16)]
Serout USERCPU, OUTBAUD, [255,255,p1_y,relayA,p2_y,relayB,p3_y,p4_y,p1_x,p2_x,p3_x,p4_x,p1_wheel,p2_wheel,p3_wheel,p4_wheel]
The first line is only a comment and the PWMs are just marking the fixed positions in the Serout call where you put the values that you want to send out to the motors. Position is everything in the Serout call. For example, see that (PWM1) is the third argument in the comment line. That means in the real line of code below it the value of p1_y, as the third argument, will be sent out to drive PWM1.
The default code actually reuses existing variables to hold the pwm values it wants to send. For instance, p3_y is used here is these lines straight from the default:
Code:
if rc_sw5 = 0 then next1:
p3_y = p3_y MAX 127
next1:
p3_y is then used as the seventh argument in the Serout call, so it's holding the value for (PWM3).
-----------
If you do go with declaring the PWMs you started with, then I'd recommend just copying the working line of code and commenting out the original line ('). Then just replace p1_y, etc with the four PWM variables you're using.