How to combine two programs?

I am using Bot Board II with BASIC Atom Pro 28 to control digital potentiometers.
I made 2 programs (I and II) and both work well separately. However, when I try to use one controller to control two or more digital potentiometers by combining these two programs, I could not get it work. If any one can help me to correct the combined program (program III), I would greatly appreciate it.

Program I:

main high P2 for counter =0 to 127 pulsout P1, P2 pause 30 next high P2 pulsout P1, P2 pause time1 then low P2 for counter =0 to 127 pulsout P1, P2 pause 300 next goto main
Program II:

main high P6 for counter =0 to 127 pulsout P5, P6 pause 30 next high P6 pulsout P5, P6 pause time1 then low P6 for counter =0 to 127 pulsout P5, P6 pause 300 next goto main
Program III (combined program)

main high P2 for counter =0 to 127 pulsout P1, P2 high P6 for counter =0 to 127 pulsout P5, P6 pause 30 next high P2 pulsout P1, P2 high P6 pulsout P5, P6 pause 60000 then low P2 for counter =0 to 127 pulsout P1, P2 low P6 for counter =0 to 127 pulsout P5, P6 pause 300 next goto main

Hi,

In the code you posted before, there seem to be an issue where when you combined the for loops your forgot to remove one of the “for counter = 0 to 127” and to reorder one of the initial states.

Here is a revision of your code:

main high P2 high P6 for counter =0 to 127 pulsout P1, P2 pulsout P5, P6 pause 30 next high P2 high P6 pulsout P1, P2 pulsout P5, P6 pause 60000 then low P2 low P6 for counter =0 to 127 pulsout P1, P2 pulsout P5, P6 pause 300 next goto main
Please note that our Basic Micro based products have all been discontinued (the manufacturer stopped producing the chips / offering support) so we may not be able to offer much more direct support with situations you may encounter while coding for this platform.

Here is a reference from the manual for the PULSOUT instruction:

Sincerely,