已解决! 转到解答。
Daniel Morley wrote:void ReadPosition(int pos){
if (POSSW1==DOWN&&POSSW2==DOWN&&POSSW3==DOWN&&POSSW4==DOWN)
pos=0;
if (POSSW1==DOWN&&POSSW2==DOWN&&POSSW3==DOWN&&POSSW4==UP)
pos=1;
// etc.
}Which works fine. However it does not allow me to pass the pos value back to the main program.int x;ReadPosition(x);
if (x==0) {
Forward();
Delay(3);
Brake();
}How should I set this up to pass the variable back to the main program
// etc.
Daniel Morley wrote:void ReadPosition(int pos){
if (POSSW1==DOWN&&POSSW2==DOWN&&POSSW3==DOWN&&POSSW4==DOWN)
pos=0;
if (POSSW1==DOWN&&POSSW2==DOWN&&POSSW3==DOWN&&POSSW4==UP)
pos=1;
// etc.
}Which works fine. However it does not allow me to pass the pos value back to the main program.int x;ReadPosition(x);
if (x==0) {
Forward();
Delay(3);
Brake();
}How should I set this up to pass the variable back to the main program
// etc.