Am trying to use multitasking on 18M2 but keep getting compiler error "start label must be at start of program".
i have seen other examples of multitasking code that does not have start0 at the beginning. I have moved the SYMBOL part of code into the START sections, but it does not run START0 and START1 simultaneously. In fact, start1 doesn't run.
i have seen other examples of multitasking code that does not have start0 at the beginning. I have moved the SYMBOL part of code into the START sections, but it does not run START0 and START1 simultaneously. In fact, start1 doesn't run.
Code:
#Picaxe 18M2
'Witch Prop
symbol PIR= B.7 `PIR sensor
symbol TENDA=B.3 `Tenda RXD `
symbol Debounce=b8
symbol BAUD=T4800
symbol Wait_If_Busy=pinB.1 `Tenda Busy Line
let dirsc=%11000001
let pinsc=%00000000
let w0 = time
symbol sequence =w0
random w1
pause w2
Init: 'Staring point to setup all inputs, outputs and set variables
serout TENDA,BAUD, ($EF); 'STOP MP3 module
pause 5000
serout TENDA,BAUD, ($E8) `set Tenda Volume
pause 60000
;
Start0:
Do
serout TENDA, Baud, ($F2,01) `play Track 1, Folder 2
pause 1000
readadc PIR,debounce
if debounce>50 then Open_Chant 'if triggered go to opening chant
gosub Test_Busy_Line 'check busy line before doing anything else
loop while debounce < 50 'if not triggered sit in this loop
Test_Busy_Line:
Do
if Wait_If_Busy = 1 then exit
Loop
return
Open_chant:
Gosub Clear_Debounce 'clear Trigger
Pause 1000
serout TENDA,BAUD,($F2,02) 'play cackle,Track 2, folder 2
do
if Wait_If_Busy=1 then gosub Spellcast 'wait unti track ends
loop
Spellcast:
serout TENDA,BAUD,($00) 'random selection of verses
pause 1000
do
if Wait_If_Busy=1 then goto start0'watch for spellcast to end and return to start0
loop
Clear_Debounce:
Debounce=0
return
Start1:
do
random sequence
let pinsc =sequence
random w1
w2=w1//1000 + 4000
pause w2
random sequence
let pinsc =sequence
random w1
w2=w1//1000 + 4000
pause w2
pinsc=0
pause 500
loop