PDA

View Full Version : Change to Initializing Inputs and Outputs


Jferrante
01-07-2003, 01:42 AM
In the section Initialize Inputs & Outputs I have noticed that all the pwm's which are normally set to start at 127 are totally missing for this years default code. Did anyone else notice this? Was the starting value necessary or was that just extra stuff that really wasnt needed?

rwaliany
01-07-2003, 02:00 AM
I would be too scared to try the program without it. It might work. It might not. I know if your NOT using the new RC you have to initialize them or you might get some unwanted feedback, like a kick.

But yeah, if first could give us a default code when there isn't a working compiler, I think there is a good chance that we still need the initialization and they just forgot it.

Serin should overwrite any variables that are in its call, otherwise set it to an arbitrary ZERO(0 or 127).

rbayer
01-07-2003, 10:25 AM
I assume you are referring to the fact that the Serout now only has 14 arguments instead of the old 18? In that case, it will (and always has!) be just fine. If you don't output a variable, the Output uP will just set them to 127.

--Rob

Jferrante
01-07-2003, 11:13 AM
Originally posted by rbayer
I assume you are referring to the fact that the Serout now only has 14 arguments instead of the old 18? In that case, it will (and always has!) be just fine. If you don't output a variable, the Output uP will just set them to 127.

--Rob

I hadn't even noticed that (I only edited serout for tank drive, other than that I leave those alone).

I was referring to the following lines not present in this years default program:
p1_x = 127 'Port 1, X-axis on Joystick
p2_x = 127 'Port 2, X-axis on Joystick
p3_x = 127 'Port 3, X-axis on Joystick
p4_x = 127 'Port 4, X-axis on Joystick

p1_y = 127 'Port 1, Y-axis on Joystick
p2_y = 127 'Port 2, Y-axis on Joystick
p3_y = 127 'Port 3, Y-axis on Joystick
p4_y = 127 'Port 4, Y-axis on Joystick

p1_wheel = 127 'Port 1, Wheel on Joystick
p2_wheel = 127 'Port 2, Wheel on Joystick
p3_wheel = 127 'Port 3, Wheel on Joystick
p4_wheel = 127 'Port 4, Wheel on Joystick
'p1_aux = 127 'Port 1, Aux Analog
'p2_aux = 127 'Port 2, Aux Analog
'p3_aux = 127 'Port 3, Aux Analog
'p4_aux = 127 'Port 4, Aux Analog


It used to be directly below this:

'---------- Initialize Inputs & Outputs --------------------------------------
Out7 = 1 'Basic Run LED on RC
Out8 = 0 'PWM1 LED - Green
Out9 = 0 'PWM1 LED - Red
Out10 = 0 'PWM2 LED - Green
Out11 = 0 'PWM2 LED - Red
Out12 = 0 'Relay1 LED - Red
Out13 = 0 'Relay1 LED - Green
Out14 = 0 'Relay2 LED - Red
Out15 = 0 'Relay2 LED - Green

now its not there. I was wondering if I needed to add it or if the robot would run fine without it

rbayer
01-07-2003, 11:36 AM
Those are actually fairly worthless. Any variables you are inputting get read in at that first Serin, overriding anything you choose to initialize them with. As long as you still have the VAR statements (ie p1_x VAR byte), you'll be just fine.