sebibi775 | Code :
- #include <UTFT.h>
- extern uint8_t SmallFont[];
- extern uint8_t BigFont[];
- extern uint8_t SevenSegNumFont[];
- extern unsigned short icon1[0x400];
- extern unsigned short icon2[0x400];
- extern unsigned short tux[0x1000];
- UTFT myGLCD(ITDB28,2,3,4,5,6); //MOSI, SCLK, CS, RESET, RS
- int i;
- void setup()
- {
- myGLCD.InitLCD(PORTRAIT);
- myGLCD.clrScr();
- }
- void loop()
- {
- // Draw crosshairs
- myGLCD.fillScr(255,255,255);
- myGLCD.setColor(0,0,0);
- myGLCD.drawLine(63,14,63,115);
- myGLCD.drawLine(1,63,126,63);
- for(i=3;i<128;i+=10) myGLCD.drawLine(i,61,i,65);
- for(i=14;i<118;i+=10) myGLCD.drawLine(61,i,65,i);
-
- // Draw sin-, cos- and tan-lines
- myGLCD.setFont(SmallFont);
- myGLCD.setColor(255,0,0);
- myGLCD.print("Sin",2,14);
- for (int i=1; i<126; i++)
- {
- myGLCD.drawPixel(i,63+(sin(((i*2.85)*3.14)/180)*45));
- delay(100);
- }
-
- myGLCD.setColor(0,0,255);
- myGLCD.print("Cos",2,26);
- for (int i=1; i<126; i++)
- {
- myGLCD.drawPixel(i,63+(cos(((i*2.85)*3.14)/180)*45));
- delay(100);
- }
- delay(1000);
-
- // Test lines
- myGLCD.fillScr(255,255,255);
- myGLCD.setFont(SmallFont);
- for(i=0;i<16;i++)
- {
- switch(i)
- {
- case 0: case 7: case 14:
- {
- myGLCD.setColor(0,0,0);
- break;
- }
- case 1: case 8: case 15:
- {
- myGLCD.setColor(0,0,255);
- break;
- }
- case 2: case 9:
- {
- myGLCD.setColor(0,255,0);
- break;
- }
- case 3: case 10:
- {
- myGLCD.setColor(0,255,255);
- break;
- }
- case 4: case 11:
- {
- myGLCD.setColor(255,0,0);
- break;
- }
- case 5: case 12:
- {
- myGLCD.setColor(255,0,255);
- break;
- }
- case 6: case 13:
- {
- myGLCD.setColor(255,255,0);
- break;
- }
- }
- myGLCD.print("shahrulnizam.com",CENTER,10*i);
- delay(1000);
- }
-
-
- }
|
|