Demo of current functions .

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "KS0108.h"        
00003 #include "image.h"
00004     
00005 KS0108 display (p13,p12, p14, p11, p21, p22, p30, p29, p28, p27, p26, p25, p24, p23);                        
00006 void testlib(int i);
00007 
00008 int main() {
00009 
00010     display.ClearScreen();     
00011     display.RoundRectangle(0,0,127,63,3,BLACK);
00012     
00013     while(1){          
00014        
00015        for(int i=0;i<7;i++){
00016         testlib(i);    
00017         wait(2);
00018         display.ClearScreen();
00019        }
00020     }
00021 
00022 }
00023 
00024 void testlib(int i){
00025 
00026     switch(i){
00027          case 1:
00028             for(int i=0;i<10;i++){
00029             display.SetPixel(i*10,i+10,BLACK);    
00030              }
00031             break;
00032          case 2:
00033             display.HLine(20,70,30,BLACK);
00034             display.HLineShort(30,20,50,BLACK);
00035             display.VLine(20,40,30,BLACK);
00036             display.VLineShort(70,5,50,BLACK);
00037             display.SlantyLine(5,8,20,30,BLACK);
00038             display.DegreeLine(15,30,30,6,20,BLACK); 
00039              break;
00040           case 3:
00041             display.FullRectangle(10,30,15,34,BLACK);
00042             display.EmptyRectangle(5,5,50,59,BLACK);
00043             display.RoundRectangle(30,20,80,35,7,BLACK);                
00044              break;
00045           case 4:
00046             display.EmptyCircle(60,20,10,BLACK);
00047             display.FullCircle(40,30,5,BLACK);
00048             display.PlotEllipse(40,20,40,20,BLACK);
00049              break;
00050           case 5:
00051             display.FullScreenBMP(pic);
00052             wait(1);            
00053             break;
00054           case 6:
00055             display.PutString(3,2,"I can has mbed too");
00056             display.PrintFloat(123.23,4,5);
00057             display.PrintInteger(3,5,7);
00058              break;
00059 
00060          default: break;
00061      }
00062  }