Toto je má konečná verze maturitního projektu

Dependencies:   mbed mbed-rtos UTouch_vyrobek UniGraphic

Revision:
12:9bc02f9e16e3
Parent:
11:4ca8388080c6
Child:
13:4a5997f90d18
diff -r 4ca8388080c6 -r 9bc02f9e16e3 display.cpp
--- a/display.cpp	Tue Feb 01 13:37:40 2022 +0000
+++ b/display.cpp	Fri Feb 25 16:16:58 2022 +0000
@@ -3,24 +3,23 @@
 
 UTouch touch(D5,D4,D3,D2,D1);//clk,chip_select,MOSI,miso,irq
 ILI9341 spi(SPI_8,320000000,PTD2,PTD3,PTD1,PTE24, PTE25, PTC4, "TFT",240,320);// mosi, miso, sclk, chip_select, reset, dc
-DigitalOut my_green(LED2);
-DigitalOut my_red(LED4);
-DigitalOut my_blue(LED3);
-DigitalOut led2(LED2);
+
 Thread thread;
 Thread thread_h;
 PwmOut br(D10);
 
-
-
+DigitalOut rel(D0);
 PwmOut r(PTC10);
 PwmOut g(PTC3);
 PwmOut b(PTC2);
 
+float rychlost = 0.05;
 float led_jas = 80;
 float lcd_jas = 0.50f;
+int barvy[9] = {};
 int jas[] = {Cyan,White};
 int jas_s = 2;
+int jas_led = 2;
 int jazyk_s = 0;
 int cas_hodiny = 0;
 int cas_minuty = 0;
@@ -35,23 +34,29 @@
 char minutka[32];
 char hodinka[32];
 char buffer[32];
-char jazyk [4][150] = {
+char jazyk [6][150] = {
+                         "Czech",
+                         "English",
+                         " Set Time",
+                         "Brightness",
+                         " ON",
+                         " OFF"
+                     };   
+char en[6][150] = {
                          "Czech",
                          "English",
                          " Set Time",
-                         "Brightness"
-                     };   
-char en[4][150] = {
-                         "Czech",
-                         "English",
-                         " Set Time",
-                         "Brightness"
+                         "Brightness",
+                         " ON",
+                         " OFF"
                      };
-char cz[4][150] = {
+char cz[6][150] = {
                          "Cestina",
                          "Anglictina",
                          "Nastavit cas",
-                         "   Jas"
+                         "   Jas",
+                         "Zap.",
+                         "Vyp."
                      };
 
 
@@ -208,9 +213,9 @@
     
     int cudlik_1[] = {10,213,58,260};
     int cudlik_2[] = {10,137,58,184};
-
-
-
+    int cudlik_3[] = {10,60,58,107};
+    int cudlik_4[] = {76,213,123,260};
+    int cudlik_5[] = {76,137,123,184};
       
   
     while(1)
@@ -315,8 +320,8 @@
             spi.fillrect(214,200,320,240,Select);
             spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy_s);
              hold();
-              grafika(5);
-            color_picker();
+            grafika(5);
+            Menu(1);
         
             }  
             //stred pravy spodni cudlik
@@ -339,18 +344,68 @@
             //prvni
           //druhy
             if ((touch_x > cudlik_2[0]) && (touch_x < cudlik_2[2]) && (touch_y < cudlik_2[3]) && (touch_y > cudlik_2[1]) && (strana == 1)){
-            spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1s_vrch);
-            spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1s_spodek);
+            spi.Bitmap(137,10,48,24,(unsigned char*)gImage_cudlik2s_vrch);
+            spi.Bitmap(137,34,48,24,(unsigned char*)gImage_cudlik2s_spodek);
             hold();
-            spi.Bitmap(60,10,48,24,(unsigned char*)gImage_cudlik1_vrch);
-            spi.Bitmap(60,34,48,24,(unsigned char*)gImage_cudlik1_spodek);
+            spi.Bitmap(137,10,48,24,(unsigned char*)gImage_cudlik2_vrch);
+            spi.Bitmap(137,34,48,24,(unsigned char*)gImage_cudlik2_spodek);
+            grafika(7);
+            grafika(9);
+            set_fadeinout();
                wait(0.2);
            
             } 
 
             
             //druhy
-                      
+               //treti
+            if ((touch_x > cudlik_3[0]) && (touch_x < cudlik_3[2]) && (touch_y < cudlik_3[3]) && (touch_y > cudlik_3[1]) && (strana == 1)){
+            spi.Bitmap(213,10,48,24,(unsigned char*)gImage_cudlik3s_vrch);
+            spi.Bitmap(213,34,48,24,(unsigned char*)gImage_cudlik3s_spodek);
+            hold();
+            spi.Bitmap(213,10,48,24,(unsigned char*)gImage_cudlik3_vrch);
+            spi.Bitmap(213,34,48,24,(unsigned char*)gImage_cudlik3_spodek);
+            grafika(7);
+            grafika(9);
+            set_rainbow();
+               wait(0.2);
+           
+            } 
+
+            
+            //treti
+            //ctvrty
+            if ((touch_x > cudlik_4[0]) && (touch_x < cudlik_4[2]) && (touch_y < cudlik_4[3]) && (touch_y > cudlik_4[1]) && (strana == 1)){
+            spi.Bitmap(60,76,48,24,(unsigned char*)gImage_cudlik4s_vrch);
+            spi.Bitmap(60,100,48,24,(unsigned char*)gImage_cudlik4s_spodek);
+            hold();
+            spi.Bitmap(60,76,48,24,(unsigned char*)gImage_cudlik4_vrch);
+            spi.Bitmap(60,100,48,24,(unsigned char*)gImage_cudlik4_spodek);
+            grafika(7);
+            grafika(9);
+            set_flash();
+               wait(0.2);
+           
+            } 
+
+            
+            //ctvrty
+            //paty
+            if ((touch_x > cudlik_5[0]) && (touch_x < cudlik_5[2]) && (touch_y < cudlik_5[3]) && (touch_y > cudlik_5[1]) && (strana == 1)){
+            spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_dopredu_s);
+            spi.Bitmap(137,100,48,24,(unsigned char*)gImage_cudlik1s_spodek);
+            hold();
+            spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_dopredu);
+            spi.Bitmap(137,100,48,24,(unsigned char*)gImage_cudlik1_spodek);
+            grafika(7);
+            grafika(9);
+            set_change();
+               wait(0.2);
+           
+            } 
+
+            
+            //paty       
         }
       }
     }    
@@ -381,16 +436,16 @@
     //prvni rada
     
     //druha rada
-    spi.Bitmap(213,76,48,24,(unsigned char*)gImage_cudlik1_vrch);
-    spi.Bitmap(213,100,48,24,(unsigned char*)gImage_cudlik1_spodek);
+    //spi.Bitmap(213,76,48,24,(unsigned char*)gImage_cudlik1_vrch);
+    //spi.Bitmap(213,100,48,24,(unsigned char*)gImage_cudlik1_spodek);
     
-    spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_vrch);
+    spi.Bitmap(137,76,48,24,(unsigned char*)gImage_cudlik1_dopredu);
     spi.Bitmap(137,100,48,24,(unsigned char*)gImage_cudlik1_spodek);
     
     spi.Bitmap(60,76,48,24,(unsigned char*)gImage_cudlik4_vrch);
     spi.Bitmap(60,100,48,24,(unsigned char*)gImage_cudlik4_spodek);
     // druha rada
-    
+    /*
     //treti rada
     spi.Bitmap(213,142,48,24,(unsigned char*)gImage_cudlik1_vrch);
     spi.Bitmap(213,166,48,24,(unsigned char*)gImage_cudlik1_spodek);
@@ -402,6 +457,8 @@
     spi.Bitmap(60,166,48,24,(unsigned char*)gImage_cudlik1_spodek);
     // treti rada
     
+    */
+    
     //CUDLIKY*******************************************************************************
 
     strana = 1;
@@ -416,11 +473,12 @@
     }
 
 void Static(){
-
+    
+    
     int green1[] = {109,40,212,143};
     int green[] = {40,109,143,212};
     
-    int stredni_pravy[] = {200,0,240,106}; //stred levy spodni cudlik
+    int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik
     int pravy[] = {34,0,165,46}; //pravý čudlík
     int levy[] = {34,274,165,320}; //levý čudlík
     
@@ -430,6 +488,11 @@
 
     int color_pick = White;
     
+    spi.fillrect(0,200,320,240,Black);
+    spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Black);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);
     while(1)
     {
       if (touch.DataAvailable())
@@ -488,11 +551,746 @@
      send_color(255,0,127,led_jas);
       break;
     default:
-    send_color(255,255,255,led_jas);
+    send_color(0,0,0,led_jas);
 }
      
-              grafika(1);
-              grafika(2);
+              grafika();
+              Menu();
+            }       
+            //pravý čudlik
+            
+            //levý čudlik 
+            if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){
+            //GRAFIKA**************************************************
+        spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s);
+        spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy
+        spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s);
+        spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            
+            hold();
+              grafika();
+              Menu();
+            }  
+            //levý čudlik
+
+          
+          //levý spodni čudlik
+            if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){
+            spi.fillrect(0,200,320,240,Select);
+            
+            spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Select);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);
+              
+            hold();
+            led_jas = brightness_led();
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(green1[0],green1[1],green1[2],green1[3],color_pick);
+            spi.fillrect(0,200,320,240,Black); 
+            spi.background(Black);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);     
+            }  
+            //levý spodni čudlik
+          
+if((touch_x > green[0]) && (touch_x < green[2]) && (touch_y < green[3]) && (touch_y > green[1])){  
+            hold(); 
+            color_pick = color_picker(); 
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(green1[0],green1[1],green1[2],green1[3],color_pick);  
+}
+         }
+    } 
+  }
+
+}
+
+
+
+void set_fadeinout(){
+    
+    int pole3[] = {213,76,260,124};
+    int pole2[] = {137,76,184,124};
+    int pole1[] = {60,76,107,124};
+    
+    int pole1_t[] = {76,213,124,260};
+    int pole2_t[] = {76,137,124,184};
+    int pole3_t[] = {76,60,124,107};
+    
+    int pick_time_t[] = {142,137,189,184};
+     
+    int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik
+    int pravy[] = {34,0,165,46}; //pravý čudlík
+    int levy[] = {34,274,165,320}; //levý čudlík
+    
+    spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+    
+    int color_pick1 = Black;
+    int color_pick2 = Black;
+    int color_pick3 = Black;
+    
+    int time_picked = 1;
+    float rychlost_tady = 0.01;
+    spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+    spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+    spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);
+    
+    spi.fillrect(0,200,320,240,Black);
+    spi.fillrect(137,142,184,189,Black);
+    spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Black);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);
+    spi.set_font((unsigned char*) Arial28x28);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+    while(1)
+    {
+      if (touch.DataAvailable())
+      {
+        if(touch.Read())
+        {
+         unsigned short int touch_y = touch.GetX();  // 0-320
+         unsigned short int  touch_x = touch.GetY(); // 0-240
+         
+          //pravý čudlik
+            if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){
+            
+            //GRAFIKA**************************************************
+            spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s);
+            spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s);
+            spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s);
+            spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            hold();
+            thread.terminate();
+            int p = 0;
+            while(p < 9){
+        barvy[p] = 0;
+        p++;
+    }
+            rychlost = rychlost_tady;
+    switch (color_pick1){
+    case Red:
+     barvy[0] = 255;
+     barvy[1] = 0;
+     barvy[2] = 0;
+      break;
+    case Orange:
+    barvy[0] = 255;
+     barvy[1] = 128;
+     barvy[2] = 0;
+      break;
+    case Yellow:
+    barvy[0] = 255;
+     barvy[1] = 255;
+     barvy[2] = 0;
+      break;
+    case GreenYellow:
+    barvy[0] = 128;
+     barvy[1] = 255;
+     barvy[2] = 0;
+      break;
+    case Green:
+    barvy[0] = 0;
+     barvy[1] = 255;
+     barvy[2] = 0;
+      break;
+    case White:
+    barvy[0] = 255;
+     barvy[1] = 255;
+     barvy[2] = 255;
+      break;
+    case Cyan:
+    barvy[0] = 0;
+     barvy[1] = 255;
+     barvy[2] = 255;
+      break;
+    case DarkCyan:
+    barvy[0] = 0;
+     barvy[1] = 127;
+     barvy[2] = 255;
+      break;
+    case Blue:
+    barvy[0] = 0;
+     barvy[1] = 0;
+     barvy[2] = 255;
+      break;
+    case Purple:
+    barvy[0] = 128;
+     barvy[1] = 0;
+     barvy[2] = 255;
+      break;
+    case Magenta:
+    barvy[0] = 255;
+     barvy[1] = 0;
+     barvy[2] = 255;
+      break;
+    case Pink:
+    barvy[0] = 255;
+     barvy[1] = 0;
+     barvy[2] = 127;
+      break;
+    default:
+    printf("err");
+}
+     switch (color_pick2){
+    case Red:
+     barvy[3] = 255;
+     barvy[4] = 0;
+     barvy[5] = 0;
+
+      break;
+    case Orange:
+    barvy[3] = 255;
+     barvy[4] = 128;
+     barvy[5] = 0;
+
+      break;
+    case Yellow:
+    barvy[3] = 255;
+     barvy[4] = 255;
+     barvy[5] = 0;
+
+      break;
+    case GreenYellow:
+    barvy[3] = 128;
+     barvy[4] = 255;
+     barvy[5] = 0;
+      break;
+    case Green:
+    barvy[3] = 0;
+     barvy[4] = 255;
+     barvy[5] = 0;
+
+      break;
+    case White:
+    barvy[3] = 255;
+     barvy[4] = 255;
+     barvy[5] = 255;
+
+      break;
+    case Cyan:
+    barvy[3] = 0;
+     barvy[4] = 255;
+     barvy[5] = 255;
+
+      break;
+    case DarkCyan:
+    barvy[3] = 0;
+     barvy[4] = 127;
+     barvy[5] = 255;
+
+      break;
+    case Blue:
+    barvy[3] = 0;
+     barvy[4] = 0;
+     barvy[5] = 255;
+
+      break;
+    case Purple:
+    barvy[3] = 128;
+     barvy[4] = 0;
+     barvy[5] = 255;
+
+      break;
+    case Magenta:
+    barvy[3] = 255;
+     barvy[4] = 0;
+     barvy[5] = 255;
+
+      break;
+    case Pink:
+    barvy[3] = 255;
+     barvy[4] = 0;
+     barvy[5] = 127;
+
+      break;
+    default:
+printf("err");
+}
+    switch (color_pick3){
+    case Red:
+     barvy[6] = 255;
+     barvy[7] = 0;
+     barvy[8] = 0;
+      break;
+    case Orange:
+    barvy[6] = 255;
+     barvy[7] = 128;
+     barvy[8] = 0;
+
+      break;
+    case Yellow:
+    barvy[6] = 255;
+     barvy[7] = 255;
+     barvy[8] = 0;
+
+      break;
+    case GreenYellow:
+    barvy[6] = 128;
+     barvy[7] = 255;
+     barvy[8] = 0;
+
+      break;
+    case Green:
+    barvy[6] = 0;
+     barvy[7] = 255;
+     barvy[8] = 0;
+
+      break;
+    case White:
+    barvy[6] = 255;
+     barvy[7] = 255;
+     barvy[8] = 255;
+
+      break;
+    case Cyan:
+    barvy[6] = 0;
+     barvy[7] = 255;
+     barvy[8] = 255;
+
+      break;
+    case DarkCyan:
+    barvy[6] = 0;
+     barvy[7] = 127;
+     barvy[8] = 255;
+
+      break;
+    case Blue:
+    barvy[6] = 0;
+     barvy[7] = 0;
+     barvy[8] = 255;
+
+      break;
+    case Purple:
+    barvy[6] = 128;
+     barvy[7] = 0;
+     barvy[8] = 255;
+
+      break;
+    case Magenta:
+    barvy[6] = 255;
+     barvy[7] = 0;
+     barvy[8] = 255;
+
+      break;
+    case Pink:
+    barvy[6] = 255;
+     barvy[7] = 0;
+     barvy[8] = 127;
+
+      break;
+    default:
+    printf("err");
+}           
+           thread.start(fadeinout);
+              grafika();
+              Menu();
+            }       
+            //pravý čudlik
+            
+            //levý čudlik 
+            if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){
+            //GRAFIKA**************************************************
+        spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s);
+        spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy
+        spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s);
+        spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            
+            hold();
+              grafika();
+              Menu();
+            }  
+            //levý čudlik
+
+          
+          //levý spodni čudlik
+            if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){
+            spi.fillrect(0,200,320,240,Select);
+            
+            spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Select);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);
+              
+            hold();
+            led_jas = brightness_led();
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+    spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+    spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+            spi.background(Black);
+            spi.locate(153,155);
+            spi.printf("%d",time_picked);
+            spi.fillrect(0,200,320,240,Black); 
+            spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Black);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);     
+            }  
+            //levý spodni čudlik
+          
+if((touch_x > pole1_t[0]) && (touch_x < pole1_t[2]) && (touch_y < pole1_t[3]) && (touch_y > pole1_t[1])){  
+            hold(); 
+            color_pick1 = color_picker(); 
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+            spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+            spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); 
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked); 
+}
+
+if((touch_x > pole2_t[0]) && (touch_x < pole2_t[2]) && (touch_y < pole2_t[3]) && (touch_y > pole2_t[1])){  
+            hold(); 
+            color_pick2 = color_picker(); 
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+            spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+            spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);  
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+}
+
+if((touch_x > pole3_t[0]) && (touch_x < pole3_t[2]) && (touch_y < pole3_t[3]) && (touch_y > pole3_t[1])){  
+            hold(); 
+            color_pick3 = color_picker(); 
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+            spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+            spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);  
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+}
+
+
+if((touch_x > pick_time_t[0]) && (touch_x < pick_time_t[2]) && (touch_y < pick_time_t[3]) && (touch_y > pick_time_t[1])){  
+   spi.fillrect(137,142,184,189,Select);
+    spi.background(Select);
+    spi.set_font((unsigned char*) Arial28x28);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+    hold();
+    time_picked++;
+    switch(time_picked){
+    case 1:
+      rychlost_tady = 0.01;
+      break;
+    case 2:
+      rychlost_tady = 0.03;
+      break;
+    case 3:
+     rychlost_tady = 0.06;
+      break;
+    case 4:
+      rychlost_tady = 0.1;
+      break;
+    default:
+      time_picked = 1;
+      rychlost_tady = 0.01;
+} 
+    spi.fillrect(137,142,184,189,Black);
+    spi.background(Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+}
+         }
+    } 
+  }
+
+}
+
+void set_flash(){
+    
+    int pole3[] = {213,76,260,124};
+    int pole2[] = {137,76,184,124};
+    int pole1[] = {60,76,107,124};
+    
+    int pole1_t[] = {76,213,124,260};
+    int pole2_t[] = {76,137,124,184};
+    int pole3_t[] = {76,60,124,107};
+    
+    int pick_time_t[] = {142,137,189,184};
+     
+    int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik
+    int pravy[] = {34,0,165,46}; //pravý čudlík
+    int levy[] = {34,274,165,320}; //levý čudlík
+    
+    spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+    
+    int color_pick1 = Black;
+    int color_pick2 = Black;
+    int color_pick3 = Black;
+    
+    int time_picked = 1;
+    float rychlost_tady = 1;
+    spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+    spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+    spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);
+    
+    spi.fillrect(0,200,320,240,Black);
+    spi.fillrect(137,142,184,189,Black);
+    spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Black);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);
+    spi.set_font((unsigned char*) Arial28x28);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+    while(1)
+    {
+      if (touch.DataAvailable())
+      {
+        if(touch.Read())
+        {
+         unsigned short int touch_y = touch.GetX();  // 0-320
+         unsigned short int  touch_x = touch.GetY(); // 0-240
+         
+          //pravý čudlik
+            if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){
+            
+            //GRAFIKA**************************************************
+            spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s);
+            spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s);
+            spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s);
+            spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            hold();
+            thread.terminate();
+            int p = 0;
+            while(p < 9){
+        barvy[p] = 0;
+        p++;
+    }
+            rychlost = rychlost_tady;
+    switch (color_pick1){
+    case Red:
+     barvy[0] = 255;
+     barvy[1] = 0;
+     barvy[2] = 0;
+      break;
+    case Orange:
+    barvy[0] = 255;
+     barvy[1] = 128;
+     barvy[2] = 0;
+      break;
+    case Yellow:
+    barvy[0] = 255;
+     barvy[1] = 255;
+     barvy[2] = 0;
+      break;
+    case GreenYellow:
+    barvy[0] = 128;
+     barvy[1] = 255;
+     barvy[2] = 0;
+      break;
+    case Green:
+    barvy[0] = 0;
+     barvy[1] = 255;
+     barvy[2] = 0;
+      break;
+    case White:
+    barvy[0] = 255;
+     barvy[1] = 255;
+     barvy[2] = 255;
+      break;
+    case Cyan:
+    barvy[0] = 0;
+     barvy[1] = 255;
+     barvy[2] = 255;
+      break;
+    case DarkCyan:
+    barvy[0] = 0;
+     barvy[1] = 127;
+     barvy[2] = 255;
+      break;
+    case Blue:
+    barvy[0] = 0;
+     barvy[1] = 0;
+     barvy[2] = 255;
+      break;
+    case Purple:
+    barvy[0] = 128;
+     barvy[1] = 0;
+     barvy[2] = 255;
+      break;
+    case Magenta:
+    barvy[0] = 255;
+     barvy[1] = 0;
+     barvy[2] = 255;
+      break;
+    case Pink:
+    barvy[0] = 255;
+     barvy[1] = 0;
+     barvy[2] = 127;
+      break;
+    default:
+    printf("err");
+}
+     switch (color_pick2){
+    case Red:
+     barvy[3] = 255;
+     barvy[4] = 0;
+     barvy[5] = 0;
+
+      break;
+    case Orange:
+    barvy[3] = 255;
+     barvy[4] = 128;
+     barvy[5] = 0;
+
+      break;
+    case Yellow:
+    barvy[3] = 255;
+     barvy[4] = 255;
+     barvy[5] = 0;
+
+      break;
+    case GreenYellow:
+    barvy[3] = 128;
+     barvy[4] = 255;
+     barvy[5] = 0;
+      break;
+    case Green:
+    barvy[3] = 0;
+     barvy[4] = 255;
+     barvy[5] = 0;
+
+      break;
+    case White:
+    barvy[3] = 255;
+     barvy[4] = 255;
+     barvy[5] = 255;
+
+      break;
+    case Cyan:
+    barvy[3] = 0;
+     barvy[4] = 255;
+     barvy[5] = 255;
+
+      break;
+    case DarkCyan:
+    barvy[3] = 0;
+     barvy[4] = 127;
+     barvy[5] = 255;
+
+      break;
+    case Blue:
+    barvy[3] = 0;
+     barvy[4] = 0;
+     barvy[5] = 255;
+
+      break;
+    case Purple:
+    barvy[3] = 128;
+     barvy[4] = 0;
+     barvy[5] = 255;
+
+      break;
+    case Magenta:
+    barvy[3] = 255;
+     barvy[4] = 0;
+     barvy[5] = 255;
+
+      break;
+    case Pink:
+    barvy[3] = 255;
+     barvy[4] = 0;
+     barvy[5] = 127;
+
+      break;
+    default:
+printf("err");
+}
+    switch (color_pick3){
+    case Red:
+     barvy[6] = 255;
+     barvy[7] = 0;
+     barvy[8] = 0;
+      break;
+    case Orange:
+    barvy[6] = 255;
+     barvy[7] = 128;
+     barvy[8] = 0;
+
+      break;
+    case Yellow:
+    barvy[6] = 255;
+     barvy[7] = 255;
+     barvy[8] = 0;
+
+      break;
+    case GreenYellow:
+    barvy[6] = 128;
+     barvy[7] = 255;
+     barvy[8] = 0;
+
+      break;
+    case Green:
+    barvy[6] = 0;
+     barvy[7] = 255;
+     barvy[8] = 0;
+
+      break;
+    case White:
+    barvy[6] = 255;
+     barvy[7] = 255;
+     barvy[8] = 255;
+
+      break;
+    case Cyan:
+    barvy[6] = 0;
+     barvy[7] = 255;
+     barvy[8] = 255;
+
+      break;
+    case DarkCyan:
+    barvy[6] = 0;
+     barvy[7] = 127;
+     barvy[8] = 255;
+
+      break;
+    case Blue:
+    barvy[6] = 0;
+     barvy[7] = 0;
+     barvy[8] = 255;
+
+      break;
+    case Purple:
+    barvy[6] = 128;
+     barvy[7] = 0;
+     barvy[8] = 255;
+
+      break;
+    case Magenta:
+    barvy[6] = 255;
+     barvy[7] = 0;
+     barvy[8] = 255;
+
+      break;
+    case Pink:
+    barvy[6] = 255;
+     barvy[7] = 0;
+     barvy[8] = 127;
+
+      break;
+    default:
+    printf("err");
+}           
+           thread.start(flash);
+              grafika();
               Menu();
             }       
             //pravý čudlik
@@ -507,29 +1305,238 @@
             //GRAFIKA**************************************************
             
             hold();
-              grafika(2);
-              grafika(1);
+              grafika();
               Menu();
             }  
             //levý čudlik
+
           
-          //stred pravy spodni cudlik
-            if ((touch_x > stredni_pravy[0]) && (touch_x < stredni_pravy[2]) && (touch_y < stredni_pravy[3]) && (touch_y > stredni_pravy[1])){
-            spi.fillrect(214,200,320,240,Select);
-            spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy_s);
-             hold();
-              grafika(5);
-            color_picker();
-        
+          //levý spodni čudlik
+            if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){
+            spi.fillrect(0,200,320,240,Select);
+            
+            spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Select);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);
+              
+            hold();
+            led_jas = brightness_led();
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+    spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+    spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+            spi.background(Black);
+            spi.locate(153,155);
+            spi.printf("%d",time_picked);
+            spi.fillrect(0,200,320,240,Black); 
+            spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Black);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);     
             }  
-            //stred pravy spodni cudlik
+            //levý spodni čudlik
           
-if((touch_x > green[0]) && (touch_x < green[2]) && (touch_y < green[3]) && (touch_y > green[1])){  
+if((touch_x > pole1_t[0]) && (touch_x < pole1_t[2]) && (touch_y < pole1_t[3]) && (touch_y > pole1_t[1])){  
+            hold(); 
+            color_pick1 = color_picker(); 
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+            spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+            spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); 
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked); 
+}
+
+if((touch_x > pole2_t[0]) && (touch_x < pole2_t[2]) && (touch_y < pole2_t[3]) && (touch_y > pole2_t[1])){  
+            hold(); 
+            color_pick2 = color_picker(); 
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+            spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+            spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);  
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+}
+
+if((touch_x > pole3_t[0]) && (touch_x < pole3_t[2]) && (touch_y < pole3_t[3]) && (touch_y > pole3_t[1])){  
             hold(); 
-            color_pick = color_picker(); 
+            color_pick3 = color_picker(); 
             spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
-            spi.fillrect(green1[0],green1[1],green1[2],green1[3],color_pick);  
- 
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+            spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+            spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);  
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+}
+
+
+if((touch_x > pick_time_t[0]) && (touch_x < pick_time_t[2]) && (touch_y < pick_time_t[3]) && (touch_y > pick_time_t[1])){  
+   spi.fillrect(137,142,184,189,Select);
+    spi.background(Select);
+    spi.set_font((unsigned char*) Arial28x28);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+    hold();
+    time_picked++;
+    switch(time_picked){
+    case 1:
+      rychlost_tady = 1;
+      break;
+    case 2:
+      rychlost_tady = 4;
+      break;
+    case 3:
+     rychlost_tady = 8;
+      break;
+    case 4:
+      rychlost_tady = 12;
+      break;
+    default:
+      time_picked = 1;
+      rychlost_tady = 1;
+} 
+    spi.fillrect(137,142,184,189,Black);
+    spi.background(Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+}
+         }
+    } 
+  }
+
+}
+
+
+void set_rainbow(){
+    
+    int green1[] = {109,40,212,143};
+    int green[] = {40,109,143,212};
+     
+    int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik
+    int pravy[] = {34,0,165,46}; //pravý čudlík
+    int levy[] = {34,274,165,320}; //levý čudlík
+    
+    spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+    
+    spi.fillrect(green1[0],green1[1],green1[2],green1[3],Black);
+    int time_picked = 1;
+    float rychlost_tady = 0.0015;
+    
+    spi.fillrect(0,200,320,240,Black);
+
+    spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Black);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);
+    spi.set_font((unsigned char*) Arial48x47);
+    spi.locate(147,70);
+    spi.printf("%d",time_picked);
+    while(1)
+    {
+      if (touch.DataAvailable())
+      {
+        if(touch.Read())
+        {
+         unsigned short int touch_y = touch.GetX();  // 0-320
+         unsigned short int  touch_x = touch.GetY(); // 0-240
+         
+          //pravý čudlik
+            if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){
+            
+            //GRAFIKA**************************************************
+            spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s);
+            spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s);
+            spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s);
+            spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            hold();
+            thread.terminate();
+            rychlost = rychlost_tady;
+           thread.start(rainbow);
+              grafika();
+              Menu();
+            }       
+            //pravý čudlik
+            
+            //levý čudlik 
+            if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){
+            //GRAFIKA**************************************************
+        spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s);
+        spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy
+        spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s);
+        spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            
+            hold();
+              grafika();
+              Menu();
+            }  
+            //levý čudlik
+
+          
+          //levý spodni čudlik
+            if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){
+            spi.fillrect(0,200,320,240,Select);
+            
+            spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Select);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);
+              
+            hold();
+            led_jas = brightness_led();
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.set_font((unsigned char*) Arial48x47);
+            spi.fillrect(green1[0],green1[1],green1[2],green1[3],Black);
+            spi.background(Black);
+            spi.locate(147,70);
+            spi.printf("%d",time_picked);
+            spi.fillrect(0,200,320,240,Black); 
+            spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Black);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);     
+            }  
+            //levý spodni čudlik
+
+if((touch_x > green[0]) && (touch_x < green[2]) && (touch_y < green[3]) && (touch_y > green[1])){  
+   spi.fillrect(green1[0],green1[1],green1[2],green1[3],Select);
+    spi.background(Select);
+    spi.set_font((unsigned char*) Arial48x47);;
+    spi.locate(147,70);
+    spi.printf("%d",time_picked);
+    hold();
+    time_picked++;
+    switch(time_picked){
+    case 1:
+      rychlost_tady = 0.0015;
+      break;
+    case 2:
+      rychlost_tady = 0.0050;
+      break;
+    case 3:
+     rychlost_tady = 0.01;
+      break;
+    case 4:
+      rychlost_tady = 0.05;
+      break;
+    default:
+      time_picked = 1;
+      rychlost_tady = 0.05;
+} 
+    spi.fillrect(green1[0],green1[1],green1[2],green1[3],Black);
+    spi.background(Black);
+    spi.locate(147,70);
+    spi.printf("%d",time_picked);
 }
          }
     } 
@@ -537,8 +1544,577 @@
 
 }
 
+void set_change(){
+    
+    int pole3[] = {213,76,260,124};
+    int pole2[] = {137,76,184,124};
+    int pole1[] = {60,76,107,124};
+    
+    int pole1_t[] = {76,213,124,260};
+    int pole2_t[] = {76,137,124,184};
+    int pole3_t[] = {76,60,124,107};
+    
+    int pick_time_t[] = {142,137,189,184};
+     
+    int spodni_levy[] = {200,0,240,320}; // pravy spodni cudlik
+    int pravy[] = {34,0,165,46}; //pravý čudlík
+    int levy[] = {34,274,165,320}; //levý čudlík
+    
+    spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+    
+    int color_pick1 = Black;
+    int color_pick2 = Black;
+    int color_pick3 = Black;
+    
+    int time_picked = 1;
+    float rychlost_tady = 0.5;
+    spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+    spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+    spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);
+    
+    spi.fillrect(0,200,320,240,Black);
+    spi.fillrect(137,142,184,189,Black);
+    spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Black);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);
+    spi.set_font((unsigned char*) Arial28x28);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+    while(1)
+    {
+      if (touch.DataAvailable())
+      {
+        if(touch.Read())
+        {
+         unsigned short int touch_y = touch.GetX();  // 0-320
+         unsigned short int  touch_x = touch.GetY(); // 0-240
+         
+          //pravý čudlik
+            if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){
+            
+            //GRAFIKA**************************************************
+            spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s);
+            spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s);
+            spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s);
+            spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            hold();
+            thread.terminate();
+            int p = 0;
+            while(p < 9){
+        barvy[p] = 0;
+        p++;
+    }
+            rychlost = rychlost_tady;
+    switch (color_pick1){
+    case Red:
+     barvy[0] = 255;
+     barvy[1] = 0;
+     barvy[2] = 0;
+      break;
+    case Orange:
+    barvy[0] = 255;
+     barvy[1] = 128;
+     barvy[2] = 0;
+      break;
+    case Yellow:
+    barvy[0] = 255;
+     barvy[1] = 255;
+     barvy[2] = 0;
+      break;
+    case GreenYellow:
+    barvy[0] = 128;
+     barvy[1] = 255;
+     barvy[2] = 0;
+      break;
+    case Green:
+    barvy[0] = 0;
+     barvy[1] = 255;
+     barvy[2] = 0;
+      break;
+    case White:
+    barvy[0] = 255;
+     barvy[1] = 255;
+     barvy[2] = 255;
+      break;
+    case Cyan:
+    barvy[0] = 0;
+     barvy[1] = 255;
+     barvy[2] = 255;
+      break;
+    case DarkCyan:
+    barvy[0] = 0;
+     barvy[1] = 127;
+     barvy[2] = 255;
+      break;
+    case Blue:
+    barvy[0] = 0;
+     barvy[1] = 0;
+     barvy[2] = 255;
+      break;
+    case Purple:
+    barvy[0] = 128;
+     barvy[1] = 0;
+     barvy[2] = 255;
+      break;
+    case Magenta:
+    barvy[0] = 255;
+     barvy[1] = 0;
+     barvy[2] = 255;
+      break;
+    case Pink:
+    barvy[0] = 255;
+     barvy[1] = 0;
+     barvy[2] = 127;
+      break;
+    default:
+    printf("err");
+}
+     switch (color_pick2){
+    case Red:
+     barvy[3] = 255;
+     barvy[4] = 0;
+     barvy[5] = 0;
+
+      break;
+    case Orange:
+    barvy[3] = 255;
+     barvy[4] = 128;
+     barvy[5] = 0;
+
+      break;
+    case Yellow:
+    barvy[3] = 255;
+     barvy[4] = 255;
+     barvy[5] = 0;
+
+      break;
+    case GreenYellow:
+    barvy[3] = 128;
+     barvy[4] = 255;
+     barvy[5] = 0;
+      break;
+    case Green:
+    barvy[3] = 0;
+     barvy[4] = 255;
+     barvy[5] = 0;
+
+      break;
+    case White:
+    barvy[3] = 255;
+     barvy[4] = 255;
+     barvy[5] = 255;
+
+      break;
+    case Cyan:
+    barvy[3] = 0;
+     barvy[4] = 255;
+     barvy[5] = 255;
+
+      break;
+    case DarkCyan:
+    barvy[3] = 0;
+     barvy[4] = 127;
+     barvy[5] = 255;
+
+      break;
+    case Blue:
+    barvy[3] = 0;
+     barvy[4] = 0;
+     barvy[5] = 255;
+
+      break;
+    case Purple:
+    barvy[3] = 128;
+     barvy[4] = 0;
+     barvy[5] = 255;
+
+      break;
+    case Magenta:
+    barvy[3] = 255;
+     barvy[4] = 0;
+     barvy[5] = 255;
+
+      break;
+    case Pink:
+    barvy[3] = 255;
+     barvy[4] = 0;
+     barvy[5] = 127;
+
+      break;
+    default:
+printf("err");
+}
+    switch (color_pick3){
+    case Red:
+     barvy[6] = 255;
+     barvy[7] = 0;
+     barvy[8] = 0;
+      break;
+    case Orange:
+    barvy[6] = 255;
+     barvy[7] = 128;
+     barvy[8] = 0;
+
+      break;
+    case Yellow:
+    barvy[6] = 255;
+     barvy[7] = 255;
+     barvy[8] = 0;
+
+      break;
+    case GreenYellow:
+    barvy[6] = 128;
+     barvy[7] = 255;
+     barvy[8] = 0;
+
+      break;
+    case Green:
+    barvy[6] = 0;
+     barvy[7] = 255;
+     barvy[8] = 0;
+
+      break;
+    case White:
+    barvy[6] = 255;
+     barvy[7] = 255;
+     barvy[8] = 255;
+
+      break;
+    case Cyan:
+    barvy[6] = 0;
+     barvy[7] = 255;
+     barvy[8] = 255;
+
+      break;
+    case DarkCyan:
+    barvy[6] = 0;
+     barvy[7] = 127;
+     barvy[8] = 255;
+
+      break;
+    case Blue:
+    barvy[6] = 0;
+     barvy[7] = 0;
+     barvy[8] = 255;
+
+      break;
+    case Purple:
+    barvy[6] = 128;
+     barvy[7] = 0;
+     barvy[8] = 255;
+
+      break;
+    case Magenta:
+    barvy[6] = 255;
+     barvy[7] = 0;
+     barvy[8] = 255;
+
+      break;
+    case Pink:
+    barvy[6] = 255;
+     barvy[7] = 0;
+     barvy[8] = 127;
+
+      break;
+    default:
+    printf("err");
+}           
+           thread.start(change);
+              grafika();
+              Menu();
+            }       
+            //pravý čudlik
+            
+            //levý čudlik 
+            if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){
+            //GRAFIKA**************************************************
+        spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s);
+        spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy
+        spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s);
+        spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            
+            hold();
+              grafika();
+              Menu();
+            }  
+            //levý čudlik
+
+          
+          //levý spodni čudlik
+            if ((touch_x > spodni_levy[0]) && (touch_x < spodni_levy[2]) && (touch_y < spodni_levy[3]) && (touch_y > spodni_levy[1])){
+            spi.fillrect(0,200,320,240,Select);
+            
+            spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Select);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);
+              
+            hold();
+            led_jas = brightness_led();
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+    spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+    spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+            spi.background(Black);
+            spi.locate(153,155);
+            spi.printf("%d",time_picked);
+            spi.fillrect(0,200,320,240,Black); 
+            spi.set_font((unsigned char*) Arial21x21);
+            spi.background(Black);
+            spi.locate(117,210);
+            spi.printf(jazyk[3]);     
+            }  
+            //levý spodni čudlik
+          
+if((touch_x > pole1_t[0]) && (touch_x < pole1_t[2]) && (touch_y < pole1_t[3]) && (touch_y > pole1_t[1])){  
+            hold(); 
+            color_pick1 = color_picker(); 
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+            spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+            spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3); 
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked); 
+}
+
+if((touch_x > pole2_t[0]) && (touch_x < pole2_t[2]) && (touch_y < pole2_t[3]) && (touch_y > pole2_t[1])){  
+            hold(); 
+            color_pick2 = color_picker(); 
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+            spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+            spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);  
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+}
+
+if((touch_x > pole3_t[0]) && (touch_x < pole3_t[2]) && (touch_y < pole3_t[3]) && (touch_y > pole3_t[1])){  
+            hold(); 
+            color_pick3 = color_picker(); 
+            spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+            spi.fillrect(pole1[0],pole1[1],pole1[2],pole1[3],color_pick1);
+            spi.fillrect(pole2[0],pole2[1],pole2[2],pole2[3],color_pick2);
+            spi.fillrect(pole3[0],pole3[1],pole3[2],pole3[3],color_pick3);  
+            spi.set_font((unsigned char*) Arial28x28);
+            spi.fillrect(137,142,184,189,Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+}
+
+
+if((touch_x > pick_time_t[0]) && (touch_x < pick_time_t[2]) && (touch_y < pick_time_t[3]) && (touch_y > pick_time_t[1])){  
+   spi.fillrect(137,142,184,189,Select);
+    spi.background(Select);
+    spi.set_font((unsigned char*) Arial28x28);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+    hold();
+    time_picked++;
+    switch(time_picked){
+    case 1:
+      rychlost_tady = 0.5;
+      break;
+    case 2:
+      rychlost_tady = 1;
+      break;
+    case 3:
+     rychlost_tady = 3;
+      break;
+    case 4:
+      rychlost_tady = 7;
+      break;
+    default:
+      time_picked = 1;
+      rychlost_tady = 0.5;
+} 
+    spi.fillrect(137,142,184,189,Black);
+    spi.background(Black);
+    spi.locate(153,155);
+    spi.printf("%d",time_picked);
+}
+         }
+    } 
+  }
+
+}
+
+
+void change(){
+
+    while(1){
+    if(barvy[0] == 0 && barvy[1] == 0 && barvy[2] == 0){
+        
+        }else{    
+    send_color(barvy[0],barvy[1],barvy[2],led_jas);
+        wait(rychlost);
+    }
+    if(barvy[3] == 0 && barvy[4] == 0 && barvy[5] == 0){
+        
+        }else{
+    send_color(barvy[3],barvy[4],barvy[5],led_jas);
+        wait(rychlost);
+    }
+   
+   
+   if(barvy[6] == 0 && barvy[7] == 0 && barvy[8] == 0){
+        
+        }else{
+    send_color(barvy[6],barvy[7],barvy[8],led_jas);
+        wait_ms(rychlost);
+    }   
+    
+        }
+    }
+
+
+
+void flash(){
+
+    while(1){
+    if(barvy[0] == 0 && barvy[1] == 0 && barvy[2] == 0){
+        
+        }else{    
+    send_color(barvy[0],barvy[1],barvy[2],led_jas);
+        wait_ms(100);
+    send_color(barvy[0],barvy[1],barvy[2],0);
+        wait_ms(100);
+    send_color(barvy[0],barvy[1],barvy[2],led_jas);
+    wait_ms(100);
+    send_color(barvy[0],barvy[1],barvy[2],0);
+    wait(rychlost);
+    }
+    
+    
+    if(barvy[3] == 0 && barvy[4] == 0 && barvy[5] == 0){
+        
+        }else{
+    send_color(barvy[3],barvy[4],barvy[5],led_jas);
+        wait_ms(100);
+    send_color(barvy[3],barvy[4],barvy[5],0);
+        wait_ms(100);
+    send_color(barvy[3],barvy[4],barvy[5],led_jas);
+    wait_ms(100);
+    send_color(barvy[3],barvy[4],barvy[5],0);
+    wait(rychlost);
+    }
+   
+   
+   if(barvy[6] == 0 && barvy[7] == 0 && barvy[8] == 0){
+        
+        }else{
+    send_color(barvy[6],barvy[7],barvy[8],led_jas);
+        wait_ms(100);
+    send_color(barvy[6],barvy[7],barvy[8],0);
+        wait_ms(100);
+    send_color(barvy[6],barvy[7],barvy[8],led_jas);
+    wait_ms(100);
+    send_color(barvy[6],barvy[7],barvy[8],0);
+    wait(rychlost);
+    }   
+    
+        }
+    }
+
+void rainbow(){
+    int i = 0;
+    int j = 0;
+    int k = 0;
+    
+    while(1){
+    i = 0;
+    j = 0;
+    k = 255;
+ 
+    while(i < 255) {
+    i = i + 1;
+    k = k - 1;
+    send_color(i,j,k,led_jas);
+        wait(rychlost);
+    }
+    
+    while(i > 0){
+    i = i - 1;
+    j = j + 1;
+    send_color(i,j,k,led_jas);
+    wait(rychlost);   
+        }
+        
+    while(j > 0){
+    j = j - 1;
+    k = k + 1;
+    send_color(i,j,k,led_jas);
+    wait(rychlost);   
+        }
+        }
+    
+    }
+
+
+
+void fadeinout(){
+    int br = 0;
+    while(1){
+    if(barvy[0] == 0 && barvy[1] == 0 && barvy[2] == 0){
+        
+        }else{    
+    while(br < led_jas) {
+    br = br + 1;
+    send_color(barvy[0],barvy[1],barvy[2],br);
+        wait(rychlost);
+    }
+    while(br > 0){
+      br = br - 1;
+      send_color(barvy[0],barvy[1],barvy[2],br);
+    wait(rychlost);   
+        }
+    }
+    
+    if(barvy[3] == 0 && barvy[4] == 0 && barvy[5] == 0){
+        
+        }else{
+    while(br < led_jas) {
+    br = br + 1;
+    send_color(barvy[3],barvy[4],barvy[5],br);
+        wait(rychlost);
+    }
+    while(br > 0){
+      br = br - 1;
+      send_color(barvy[3],barvy[4],barvy[5],br);
+    wait(rychlost);   
+        }
+   }
+   
+   if(barvy[6] == 0 && barvy[7] == 0 && barvy[8] == 0){
+        }else{
+    while(br < led_jas) {
+    br = br + 1;
+    send_color(barvy[6],barvy[7],barvy[8],br);
+        wait(rychlost);
+    }
+    while(br > 0){
+      br = br - 1;
+      send_color(barvy[6],barvy[7],barvy[8],br);
+    wait(rychlost);   
+        }
+    }
+    
+    
+        }
+    }
+
 int color_picker(){
     
+    int levy[] = {34,274,165,320}; //levý čudlík
+    
     int pole1[] = {69,29,116,76};
     int pole2[] = {117,29,163,76};
     int pole3[] = {164,29,210,76};
@@ -589,6 +2165,25 @@
         {
          unsigned short int touch_y = touch.GetX();  // 0-320
          unsigned short int  touch_x = touch.GetY(); // 0-240
+     //levý čudlik 
+            if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){
+            //GRAFIKA**************************************************
+        spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s);
+        spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy
+        spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s);
+        spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            
+            hold();
+        spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch);
+        spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit);// levy
+        spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek);
+        spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek);
+            return Black;
+            }  
+            //levý čudlik
+     
+     
      
 if((touch_x > pole1t[0]) && (touch_x < pole1t[2]) && (touch_y < pole1t[3]) && (touch_y > pole1t[1])){
             hold();
@@ -655,12 +2250,196 @@
 
 }
 
+int brightness_led(){
+    spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
+    int pravy[] = {34,0,165,46}; //pravý čudlík
+    int levy[] = {34,274,165,320}; //levý čudlík
+    
+    int jas_temp = led_jas;
+    
+    int p10t[] = {229,52,264,147};
+    int p30t[] = {186,52,221,147};
+    int p50t[] = {143,52,178,147};
+    int p70t[] = {100,52,135,147};
+    int p90t[] = {57,52,92,147};  
+       
+    int p10[] = {57,52,92,147};
+    int p30[] = {100,52,135,147};
+    int p50[] = {143,52,178,147};
+    int p70[] = {186,52,221,147};
+    int p90[] = {229,52,264,147};
+     
+    int change = jas_led;
+    
+    switch(jas_led){
+    case 0:
+    spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]);
+    spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[1]);
+    spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]);
+    spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]);
+    spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]);
+    break;
+    case 1:
+    spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]);
+    spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]);
+    spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]);
+    spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]);
+    spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]);
+    break;
+    case 2:
+    spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]);
+    spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]);
+    spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]);
+    spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]);
+    spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]);
+    break;
+    case 3:
+    spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]);
+    spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]);
+    spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]);
+    spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]);
+    spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]);
+    break;
+    case 4:
+    spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]);
+    spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]);
+    spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]);
+    spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]);
+    spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[0]);
+    break;
+    default:
+    printf("err");
+    
+   }
+    
+    while(1){
+if(change == jas_led){
+    }else{
+        change = jas_led;      
+         switch(jas_led){
+    case 0:
+    spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]);
+    spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[1]);
+    spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]);
+    spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]);
+    spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]);
+    break;
+    case 1:
+    spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]);
+    spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]);
+    spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[1]);
+    spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]);
+    spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]);
+    break;
+    case 2:
+    spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]);
+    spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]);
+    spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]);
+    spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[1]);
+    spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]);
+    break;
+    case 3:
+    spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]);
+    spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]);
+    spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]);
+    spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]);
+    spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[1]);
+    break;
+    case 4:
+    spi.fillrect(p10[0],p10[1],p10[2],p10[3],jas[0]);
+    spi.fillrect(p30[0],p30[1],p30[2],p30[3],jas[0]);
+    spi.fillrect(p50[0],p50[1],p50[2],p50[3],jas[0]);
+    spi.fillrect(p70[0],p70[1],p70[2],p70[3],jas[0]);
+    spi.fillrect(p90[0],p90[1],p90[2],p90[3],jas[0]);
+    break;
+    default:
+    printf("err");
+    
+   }
+     
+}           
+        
+if (touch.DataAvailable())
+      {
+        if(touch.Read())
+        {
+         unsigned short int touch_y = touch.GetX();  // 0-320
+         unsigned short int  touch_x = touch.GetY(); // 0-240
+          
+          //pravý čudlik
+            if ((touch_x > pravy[0]) && (touch_x < pravy[2]) && (touch_y < pravy[3]) && (touch_y > pravy[1])){
+            
+            //GRAFIKA**************************************************
+            spi.Bitmap(274,34,46,38,(unsigned char*)gImage_vrch_s);
+            spi.Bitmap(274,72,46,42,(unsigned char*)gImage_potvrdit_s);
+            spi.Bitmap(274,114,46,26,(unsigned char*)gImage_spodek_s);
+            spi.Bitmap(274,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            hold();
+             
+              grafika(9);
+              return jas_temp; 
+            }       
+            //pravý čudlik
+            
+            //levý čudlik 
+            if ((touch_x > levy[0]) && (touch_x < levy[2]) && (touch_y < levy[3]) && (touch_y > levy[1])){
+            //GRAFIKA**************************************************
+        spi.Bitmap(0,34,46,38,(unsigned char*)gImage_vrch_s);
+        spi.Bitmap(0,72,46,42,(unsigned char*)gImage_zrusit_s);// levy
+        spi.Bitmap(0,114,46,26,(unsigned char*)gImage_spodek_s);
+        spi.Bitmap(0,140,46,26,(unsigned char*)gImage_spodek_s);
+            //GRAFIKA**************************************************
+            
+            hold();
+            jas_temp = 0;
+              grafika(7);
+             return jas_led; 
+            }  
+            //levý čudlik
+            
+if((touch_x > p10t[1]) && (touch_x < p10t[3]) && (touch_y < p10t[2]) && (touch_y > p10t[0])){
+        hold();
+        jas_led = 0;
+        jas_temp = 10;
+}
+
+if((touch_x > p30t[1]) && (touch_x < p30t[3]) && (touch_y < p30t[2]) && (touch_y > p30t[0])){
+        hold();
+        jas_led = 1;
+        jas_temp = 30;
+}
+if((touch_x > p50t[1]) && (touch_x < p50t[3]) && (touch_y < p50t[2]) && (touch_y > p50t[0])){
+        hold();
+        jas_led = 2;
+        jas_temp = 50;
+        
+}
+if((touch_x > p70t[1]) && (touch_x < p70t[3]) && (touch_y < p70t[2]) && (touch_y > p70t[0])){
+        hold();
+        jas_led = 3;
+        jas_temp = 70;
+}
+if((touch_x > p90t[1]) && (touch_x < p90t[3]) && (touch_y < p90t[2]) && (touch_y > p90t[0])){
+        hold();
+        jas_led = 4;
+        jas_temp = 90;
+}
+
+
+    }
+}
+}
+}
+
+
+
 
 void nastaveni(){   
     int pravy[] = {34,0,165,46}; //pravý čudlík
     int levy[] = {34,274,165,320}; //levý čudlík
     int i = 0;
-
+    int stredni_pravy[] = {200,0,240,106}; //stred levy spodni cudlik
         
     spi.Bitmap(46,0,228,200,(unsigned char*)gImage_pozadi);
     int check1[] = {66,10,96,40};
@@ -728,13 +2507,13 @@
              switch(jazyk_s)
 {
             case 1:
-                    while(i < 4){
+                    while(i < 6){
                         strcpy(jazyk[i], cz[i]);
                         i++;
                         }
             break;
             default:
-                    while(i < 4){
+                    while(i < 6){
                         strcpy(jazyk[i], en[i]);
                         i++;
                         }
@@ -764,7 +2543,16 @@
             wait(0.2);
             }  
             //levý čudlik
-          
+          //stred pravy spodni cudlik
+            if ((touch_x > stredni_pravy[0]) && (touch_x < stredni_pravy[2]) && (touch_y < stredni_pravy[3]) && (touch_y > stredni_pravy[1])){
+            spi.fillrect(214,200,320,240,Select);
+            spi.Bitmap(227,200,80,40,(unsigned char*)gImage_stredni_pravy_s);
+             hold();
+            grafika(5);
+            Menu(1);
+        
+            }  
+            //stred pravy spodni cudlik
 if((touch_x > prvni[1]) && (touch_x < prvni[3]) && (touch_y < prvni[2]) && (touch_y > prvni[0])){
             hold();
             jazyk_s = 1;
@@ -1002,10 +2790,10 @@
     spi.set_font((unsigned char*) Arial21x21);
     spi.background(Select);
     spi.locate(55,210);
-    spi.printf(" ON");
+    spi.printf(jazyk[4]);
     spi.background(Black);
     spi.locate(215,210);
-    spi.printf(" OFF");
+    spi.printf(jazyk[5]);
     
     spi.set_font((unsigned char*) Arial48x47);
     spi.background(MojeSeda);
@@ -1073,7 +2861,7 @@
             spi.set_font((unsigned char*) Arial21x21);
             spi.background(Select);
             spi.locate(55,210);
-            spi.printf(" ON");  
+            spi.printf(jazyk[4]);  
             
               spi.set_font((unsigned char*) Arial48x47);
               spi.background(MojeSeda);
@@ -1090,7 +2878,7 @@
             spi.set_font((unsigned char*) Arial21x21);
             spi.background(Black);
             spi.locate(215,210);
-            spi.printf(" OFF");
+            spi.printf(jazyk[5]);
             
             a = true;
             hold();
@@ -1104,7 +2892,7 @@
             spi.set_font((unsigned char*) Arial21x21);
             spi.background(Black);
             spi.locate(55,210);
-            spi.printf(" ON");  
+            spi.printf(jazyk[4]);  
             
             spi.set_font((unsigned char*) Arial48x47);
               spi.background(MojeSeda);
@@ -1122,7 +2910,7 @@
             spi.set_font((unsigned char*) Arial21x21);
             spi.background(Select);
             spi.locate(215,210);
-            spi.printf(" OFF");
+            spi.printf(jazyk[5]);
             a = false;
             hold();
             wait(0.2);
@@ -1579,12 +3367,12 @@
         set_time(cas_nastavit);
     while(1){
         time_t seconds = time(NULL);
-        //seconds = seconds + 7200;
+
         if(seconds == time_on){
-            printf("ON\r\n");
+            rel.write(1);
             }
         if(seconds == time_off){
-            printf("OFF\r\n");
+            rel.write(0);
             }
         strftime(buffer, 32, "%R", localtime(&seconds));
         strftime(hodinka, 32, "%H", localtime(&seconds));
@@ -1595,13 +3383,10 @@
     }
 
 main(){
-r.period_us(1000);
-g.period_us(1000);
-b.period_us(1000);
+r.pulsewidth(5);
+g.pulsewidth(5);
+b.pulsewidth(5);
 
-my_red = 1;
-my_green = 1;
-my_blue = 1;
     spi.set_orientation(3);
     spi.FastWindow(true);
     touch.InitTouch();
@@ -1609,66 +3394,15 @@
     spi.background(Black);
     spi.foreground(White);
     spi.cls();
-    send_color(255,20,147,100);
-
+    send_color(255,255,255,led_jas);
+    rel.write(1);
     grafika();
     
-    br.period_us(1000);
+    //br.period_us(1000);
+    br.pulsewidth(5);
     br.write(lcd_jas);
 
     Button();
 
     
 }
-
-
-
-
-/*  fail projekty
-          //slider  
-            if ((touch_x > cudlik[0]) && (touch_x < cudlik[2]) && (touch_y > cudlik[1]) && (touch_y < cudlik[3]) && (pressure > 0)){
-            
-            
-        //if je udelany tady pro nastavení minima a maxima
-           if ((touch_x > 25) && (touch_x < 140)){           
-            
-            unsigned short int y0 = cudlik[1];
-            unsigned short int y1 = cudlik[3];      
-            unsigned short int x_zadelavani_chyby = cudlik[0];
-            unsigned short int x0 = x_zadelavani_chyby - 8;
-              
-              //printf("%d\r\n",touch_x);                  
-              stred_cudliku[0] = touch_x;
-              
-              cudlik[0] = stred_cudliku[0] - 10;
-              cudlik[1] = stred_cudliku[1] - 25;
-              cudlik[2] = stred_cudliku[0] + 10;
-              cudlik[3] = stred_cudliku[1] + 25;
-              
-                              
-               
-          if (touch_x > 34){    
-              x0 = x_zadelavani_chyby + 8;
-                spi.fillrect(x0,y0,x_zadelavani_chyby,y1,Green);
-              
-              }else{
-spi.fillrect(x0,y0,x_zadelavani_chyby,y1,Black);
-                  }
-              
-         if (touch_x < 34){    
-              spi.fillrect(x0,y0,x_zadelavani_chyby,y1,Black);
-              
-              }else{
-                x0 = x_zadelavani_chyby + 8;
-                spi.fillrect(x0,y0,x_zadelavani_chyby,y1,Green);
-                  }     
-              spi.fillrect(cudlik[0],cudlik[1],cudlik[2],cudlik[3],cudlik[4]);
-              
-              
-              
-              }
-            } 
-            
-            //slider */
-
-