christiand
10-21-2009, 12:28 AM
Hi! I am looking for a command in Pbasic similar to methods in Java, where I can send in an argument.
I found GOSUB, but it doesn't seem I can send in an argument to it. This is what I want to do.
' {$STAMP BS2}
' {$PBASIC 2.5}
sData VAR Byte
DO
SERIN 16, 16468, [DEC sData]
GO_SUB method(sData) 'send variable sData to other instance of program
method(sData):
move motor to position sData 'pseudo-code
LOOP
This is how it would look in java:
moveMotor(100);
moveMotor (int pos) {
motorPosition = pos;
}
Is there anything similar in Pbasic?
regards / Christian
I found GOSUB, but it doesn't seem I can send in an argument to it. This is what I want to do.
' {$STAMP BS2}
' {$PBASIC 2.5}
sData VAR Byte
DO
SERIN 16, 16468, [DEC sData]
GO_SUB method(sData) 'send variable sData to other instance of program
method(sData):
move motor to position sData 'pseudo-code
LOOP
This is how it would look in java:
moveMotor(100);
moveMotor (int pos) {
motorPosition = pos;
}
Is there anything similar in Pbasic?
regards / Christian