key=KEY_Scan(0);
OLED_Clear();
OLED_ShowString(j,i,"-->",12); // sign
OLED_ShowString(40,8,"task1",12); // the following are task1~3 on the left of oled.
OLED_ShowString(40,24,"task2",12);
OLED_ShowString(40,40,"task3",12);
OLED_ShowString(96,8,"task4",12); //the following are task4~6 on the right of oled.
OLED_ShowString(96,24,"task5",12);
OLED_ShowString(96,40,"task6",12);
OLED_Refresh_Gram();
if(key==1) // change task[i]
{i=i+16;
if(i>40){i=8;j=j+56;
if(j>80){i=8;j=24;}}}
if(i==8 && j==24) //task1
{ if(key==2){LED1=1;}
if(key==3){LED1=0;}}
if(i==24 && j==24) //task2
{}
if(i==40 && j==24) //task3
{}
if(i==8 && j==80) //task4
{}
if(i==24 && j==80) //task5
{}
if(i==40 && j==80) //task6
{}
利用按键对自己的程序进行选择操作。比较简单,就不详细讲解了!
效果如下: