/*
backligh is 0(dark)~20(light)
*/
#include <stdio.h>
#include "..\..\lib\vp2k.h"
#include "..\..\lib\vp2k_lcd.h"
int main()
{
    int quit=0,key;
    char string[3];

    InitLib();
    LCD_Init();
  
    LCD_Gotoxy(0,0);
    LCD_Putch(0x1E,0);//0x1E=up 
    LCD_PutsAt(2,0,":brightend",0);
    
    LCD_Gotoxy(0,1);
    LCD_Putch(0x1F,0);//0x1F=down
    LCD_PutsAt(2,1,":darkend",0);
    LCD_PutsAt(0,2,"F1:Quit",0);
    LCD_PutsAt(0,3,"back light:",0);
    LCD_PutsAt(12,3,"00",0);
    while(!quit)
    {
        if(IsKey())
        {
            key=ReadKey();
            switch(key)
            {
                case UP_KEY:
                    if(*LCD_BackLight < LCD_MAX_BACK_LIGHT) (*LCD_BackLight)++;
                    break;
                case DOWN_KEY:
                    if(*LCD_BackLight > 0) (*LCD_BackLight)--;
                    break;
                case F1_KEY:
                    quit=1;
                    break;
            }//switch
            sprintf(string,"%02d",*LCD_BackLight);
            LCD_PutsAt(12,3,string,0);
        }//kbhit
  }//while loop
  LCD_Clear();
  StopOutWave1();
  return 0;
}

