|
light_counter
int light_counter (int x, int y, byte count_number, boolean i)
// Счетчик 2х разрядных чисел 3х6 px.
{ // При вызове функции i=0
byte a,b; // x, y - начальные координаты счетчика
a = count_number % 10 ; // Единицы счетчика.
b = (count_number /10) % 10 ; // Десятки счетчик
myGLCD.setColor(VGA_BLACK); // Выбираем черный (цвет фона)
myGLCD.fillRect(x,y,x+3,y+6); // Закрашиваем место будующей цифры
myGLCD.setColor(200,200,200); // Выбираем цвет цифры.
if (a == 1)
{
myGLCD.drawVLine (x+3,y+1,5);
}
if (a == 2)
{
myGLCD.drawVLine (x+3,y+1,3);
myGLCD.drawVLine (x+1,y+4,2);
myGLCD.drawHLine (x+1,y+1,1);
myGLCD.drawHLine (x+2,y+6,1);
myGLCD.drawPixel (x+2, y+4);
}
if (a == 3)
{
myGLCD.drawVLine (x+3,y+2,4);
myGLCD.drawHLine (x+1,y+1,2);
myGLCD.drawHLine (x+1,y+6,1);
myGLCD.drawPixel (x+2, y+3);
}
if (a == 4)
{
myGLCD.drawVLine (x+1,y+1,2);
myGLCD.drawVLine (x+3,y+1,5);
myGLCD.drawPixel (x+2, y+3);
}
if (a == 5)
{
myGLCD.drawVLine(x+3,y+4,1);
myGLCD.drawHLine(x+1,y+1,2);
myGLCD.drawHLine(x+1,y+3,2);
myGLCD.drawHLine(x+1,y+6,2);
myGLCD.drawPixel (x+1, y+2);
}
if (a == 6)
{
myGLCD.drawVLine(x+1,y+3,3);
myGLCD.drawVLine(x+3,y+4,2);
myGLCD.drawPixel (x+3, y+1);
myGLCD.drawPixel (x+2, y+2);
myGLCD.drawPixel (x+2, y+4);
myGLCD.drawPixel (x+2, y+6);
}
if (a == 7)
{
myGLCD.drawVLine(x+2,y+3,1);
myGLCD.drawVLine(x+1,y+5,1);
myGLCD.drawHLine(x+1,y+1,2);
myGLCD.drawPixel (x+3, y+2);
}
if (a == 8)
{
myGLCD.drawVLine(x+1,y+1,5);
myGLCD.drawVLine(x+3,y+1,5);
myGLCD.drawPixel (x+2, y+1);
myGLCD.drawPixel (x+2, y+3);
myGLCD.drawPixel (x+2, y+6);
}
if (a == 9)
{
myGLCD.drawVLine(x+1,y+1,2);
myGLCD.drawVLine(x+3,y+1,3);
myGLCD.drawPixel (x+2, y+1);
myGLCD.drawPixel (x+2, y+3);
myGLCD.drawPixel (x+2, y+5);
myGLCD.drawPixel (x+1, y+6);
}
if (a == 0)
{
myGLCD.drawVLine(x+1,y+2,3);
myGLCD.drawVLine(x+3,y+2,3);
myGLCD.drawPixel (x+2, y+1);
myGLCD.drawPixel (x+2, y+6);
}
if (i==1){return 0;};
if (b==0){return 0;};
light_counter (x-5, y, b+10, 1);
};
|
|