void bar(int x,int y,int pos,int l,int h)//kalendar(days, mon, years); l-длинна шкалы pos-позиция метки положения h-высота { //int h=40;//высота шкалы myGLCD.setBackColor(0,0,255); myGLCD.setColor(0,0,255); myGLCD.fillRoundRect(x-5, y-5, l+x+5, h+y+5);//рисуем синий пр-к myGLCD.setColor(255, 255, 255); myGLCD.drawRoundRect(x, y, l+x, h+y);//с белой обводкой //myGLCD.setColor(255,114,0); //myGLCD.fillRoundRect(80, 35, 632, 87); myGLCD.fillRoundRect(x, y, pos*l/100+x, h+y); myGLCD.setFont(BigFont); myGLCD.setColor(VGA_WHITE); myGLCD.setBackColor(0,0,255); myGLCD.print("BRIGHT", x-48+(l/2), y-25); myGLCD.printNumI(abs(pos), x-10+(l/2), y+2);// уровень в процентах } void bright() { int x=200; int y=200; int pos; int h=20;//высота шкалы int l=300;//длинна шкалы //***************** myGLCD.setColor(255, 255, 255); myGLCD.drawBitmap (x+l-30, y-37, 30, 30, xf); myGLCD.drawRoundRect (x+l-30, y-37, x+l-30+30, y-37+30);// Aandelend // myGLCD.setColor(255, 0, 0); // myGLCD.fillRoundRect ( x+l-30, y-37, x+l-30+30, y-37+30); // myGLCD.setColor(255, 255, 255); // myGLCD.setBackColor(255,0,0); // myGLCD.setFont(BigFont); // myGLCD.drawRoundRect ( x+l-30, y-37, x+l-30+30, y-37+30); //X // myGLCD.print("X", x+l-30+8, y-37+7); //*********************************** //***************** // myGLCD.setColor(0, 0, 255); // myGLCD.fillRoundRect ( x+l-30, y+26, x+l-30+30, y+26+30); // myGLCD.setColor(255, 255, 255); // myGLCD.setBackColor(0,0,255); // myGLCD.setFont(BigFont); myGLCD.drawBitmap (x+l-30, y+26, 30, 30, pr); myGLCD.drawRoundRect ( x+l-30, y+26, x+l-30+30, y+26+30); //>> // myGLCD.print(">", x+l-30+8, y+26+7); //*********************************** //***************** // myGLCD.setColor(0, 0, 255); // myGLCD.fillRoundRect ( x+l-60, y+26, x+l-60+30, y+26+30); // myGLCD.setColor(255, 255, 255); // myGLCD.setBackColor(0,0,255); // myGLCD.setFont(BigFont); myGLCD.drawBitmap (x+l-60, y+26, 30, 30, ad); myGLCD.drawRoundRect ( x+l-60, y+26, x+l-60+30, y+26+30); //+ // myGLCD.print("+", x+l-60+8, y+26+7); //*********************************** myGLCD.drawBitmap (x, y+26, 30, 30, le); myGLCD.drawRoundRect ( x, y+26, x+30, y+26+30); //< //***************** // myGLCD.setColor(0, 0, 255); // myGLCD.fillRoundRect ( x+30, y+26, x+30+30, y+26+30); // myGLCD.setColor(255, 255, 255); // myGLCD.setBackColor(0,0,255); // myGLCD.setFont(BigFont); myGLCD.drawBitmap (x+30, y+26, 30, 30, mi); myGLCD.drawRoundRect ( x+30, y+26, x+30+30, y+26+30); //- // myGLCD.print("-", x+30+8, y+26+7); //*********************************** //***************** // myGLCD.setColor(0, 0, 255); // myGLCD.fillRoundRect ( x, y+26, x+30, y+26+30); // myGLCD.setColor(255, 255, 255); // myGLCD.setBackColor(0,0,255); //myGLCD.setFont(BigFont); // myGLCD.print("<", x+8, y+26+7); //*********************************** pos=100*br/255; bar(x,y, pos,l,h); interval = 5000; previousMillis =millis(); while(1) { currentMillis = millis(); if(currentMillis - previousMillis >= interval) { // save the last time you blinked the LED previousMillis = currentMillis; interval = 10000; previousMillis=0; return; } if (myTouch.dataAvailable()) { myTouch.read(); int x1=myTouch.getX(); int y1=myTouch.getY(); if ((y1>=y-37) && (y1<=y-37+30)) // Upper row { if ((x1>= x+l-30) && (x1<= x+l-30+30)) // Aandelend {waitForIt1( x+l-30, y-37, x+l-30+30, y-37+30); interval = 10000; previousMillis=0; return; } } if ((y1>=y+26) && (y1<=y+26+30)) // Upper row { if ((x1>= x+l-30) && (x1<= x+l-30+30)) //> {brightness=brightness+25; br=constbr+brightness; if (br>255) {br=255; brightness=55; } waitForIt1( x+l-30, y+26, x+l-30+30, y+26+30); pos=100*br/255 ; bar(x,y, pos,l,h); analogWrite(12, br); } if ((x1>= x+l-60) && (x1<= x+l-60+30)) // + {brightness=brightness+1; br=constbr+brightness; if (br>255) {br=255; brightness=55; } waitForIt1( x+l-60, y+26, x+l-60+30, y+26+30); pos=100*br/255 ; bar(x,y, pos,l,h); analogWrite(12, br); } if ((x1>= x+30) && (x1<= x+30+30)) //- {brightness=brightness-1; br=constbr+brightness; if (br<1) {br=1; } waitForIt1 ( x+30, y+26, x+30+30, y+26+30); pos=100*br/255; bar(x,y, pos,l,h); analogWrite(12, br); } if ((x1>= x) && (x1<= x+30)) //< {brightness=brightness-25; br=constbr+brightness; if (br<1) {br=1; } waitForIt1 ( x, y+26, x+30, y+26+30); pos=100*br/255; bar(x,y, pos,l,h); analogWrite(12, br); } } previousMillis = currentMillis; } } }