Run two program in one stamp with one Pin by switch
This my sample program
HIGH 11 ' the problem when this pin in high it just run the main_loop
Main:
IF OUT11 = 1 THEN GOSUB main_loop ' this must wait until switch turn on
IF OUT11 = 0 THEN GOSUB recieve_mode ' i need this run first until switch turn
RETURN
Any help thanks.
HIGH 11 ' the problem when this pin in high it just run the main_loop
Main:
IF OUT11 = 1 THEN GOSUB main_loop ' this must wait until switch turn on
IF OUT11 = 0 THEN GOSUB recieve_mode ' i need this run first until switch turn
RETURN
Any help thanks.

Comments
If the switch is connected to pin 11 then you need to replace the "if Out11=" with "if in11="
Also have you a pull-up resistor on the line to start it with a known value?
i try what you say , but still have that problem , so anyway to make the main_loop run together with recieve_mode , i main it two program run at same time , because i have two bs2 run on this one project so the main_loop it that for say it module and the recieve_mode that recieve byte from the master bs2
This my sample program
HIGH 11 ' the problem when this pin in high it just run the main_loop
Main:
IF in11 = 1 THEN GOSUB main_loop ' this must wait until switch turn on
IF in11 = 0 THEN GOSUB recieve_mode ' i need this run first until switch turn
RETURN
Why are you using High11?
Have you an external switch connected to pin 11?
You need to be in advanced mode to do that. (or just use the tags)Show us the fixed sample code you tried.HIGH 11 ' the problem when this pin in high it just run the main_loop
Main:
IF OUT11 = 1 THEN GOSUB main_loop ' this must wait until switch turn on
IF OUT11 = 0 THEN GOSUB receive_mode ' i need this run first until switch turn
RETURN
Are you want to use an input on a Basic Stamp if this is the case then the command would be
this
Mode VAR IN11
DO
IF Mode = 0 THEN
GOSUB Receive_Mode
ELSE
GOSUB main_Mode
ENDIF
LOOP
Main_Mode:
'Your code
RETURN
Receive_Mode:
'Your code
RETURN
Below is a code routine doing just what your are asking to do in my routine you have to power down the Basic Stamp to change modes but I could have written so I could have done with out turning
Keep in that if you want change modes you are going to have to put this in a DO LOOP
IF OUT11 = 1 THEN GOSUB main_loop
IF OUT11 = 0 THEN GOSUB receive_mode
Using OUT11 = 1 and then right after using OUT11 = 0 is not a good habit to get into
Hi Clive i used external switch to connect to Pin 11, like i say i have use two Bs2 to connect together by Pin11 because my project need many I/O so one Bs2 not enough for it so that why i need run two program in one stamp the master stamp with all the sensor and the second with some light servo anh say it module , but say it module it have run in loop mode, i know Bs2 stamp just do one stack a time so the switch may help on this.
Sam_Sam_Sam i try your code but not work , any help thanks.