#include "eyebot.h"

int back_count, fore_count;

void slave()
{ back_count++; // do not print here, as LCD commands need mutex
}


int main()
{ int k; 

  LCDPrintf("Timer Demo\n\n");
  LCDPrintf("Background:\n\n\nForeground:");
  LCDMenu("INC","DEC","","END");

  OSAttachTimer(500, slave); // Background

  do                         // Foreground
  { k = KEYRead();
    if (k==KEY1) fore_count++;
      else if (k==KEY2) fore_count--;
    LCDSetPrintf(3,0, "%6d", back_count); 
    LCDSetPrintf(6,0, "%6d", fore_count);
    usleep(100);   // sleep 0.1 s
  } while (k!=KEY4);
  return 0;
}
