#include "ScoutDef.h"

#define TASK_MAIN   0
#define TASK_TOUCH  1
#define TASK_TIMER  2

#define LOCAL_VAR_0 10
#define LOCAL_VAR_1 11


task TASK_MAIN
  ; initialization
  out	  OUT_OFF, OUTLIST_AB           ; turn motors off
  setfb   SRC_CON, FBMASK_NO_FB         ; shut the system up
  tmrs    0, SRC_CON, CR_SEC_1          ; wait a second

  ; start sensor watchers
  start   TASK_TOUCH
  start   TASK_TIMER
endt



task TASK_TOUCH
starttask_label:

  mone    SRC_CON, EVENT_TPR, watchercode_label

forever_label:
  jmp     forever_label                 ; wait here until (one of) the event(s) happens

watchercode_label:

  plays   SND_BEEP

  jmp     starttask_label
endt


task TASK_TIMER
starttask_label:

  mone    SRC_CON, EVENT_TMR1, watchercode_label

forever_label:
  jmp     forever_label                 ; wait here until the timer triggers

watchercode_label:

  plays   SND_CLICK

  jmp     starttask_label
endt
