Stap 1: Wijzig de coördinaten
4. veranderde de punt schaal zoals
p.x = tft.width ()-(kaart (p.x, TS_MINX, TS_MAXX, 0, tft.width()));
p.y = tft.height ()-(kaart (p.y, TS_MINY, TS_MAXY, 0, tft.height()));
5. gewijzigd de coördinaten blokken en kleuren kunt weergeven
Als (p.x > BOXSIZE * 5) {}
currentcolor = rood;
tft.drawRect (BOXSIZE * 5, BOXSIZE * 0, BOXSIZE, BOXSIZE, witte);
} else if (p.x > BOXSIZE * 4) {}
currentcolor = geel;
tft.drawRect (BOXSIZE * 4, BOXSIZE * 0, BOXSIZE, BOXSIZE, witte);
} else if (p.x > BOXSIZE * 3) {}
currentcolor = groen;
tft.drawRect (BOXSIZE * 3, BOXSIZE * 0, BOXSIZE, BOXSIZE, witte);
} else if (p.x > BOXSIZE * 2) {}
currentcolor = cyaan;
tft.drawRect (BOXSIZE * 2, BOXSIZE * 0, BOXSIZE, BOXSIZE, witte);
} else if (p.x > BOXSIZE * 1) {}
currentcolor = blauw;
tft.drawRect (BOXSIZE * 1, BOXSIZE * 0, BOXSIZE, BOXSIZE, witte);
} else if (p.x > BOXSIZE * 0) {}
currentcolor = MAGENTA;
tft.drawRect (BOXSIZE * 0, BOXSIZE * 0, BOXSIZE, BOXSIZE, witte);
}
Als (oldcolor! = currentcolor) {}
Als (oldcolor == RED) tft.fillRect (BOXSIZE * 5, BOXSIZE * 0, BOXSIZE, BOXSIZE, rood);
Als (oldcolor == geel) tft.fillRect (BOXSIZE * 4, BOXSIZE * 0, BOXSIZE, BOXSIZE, gele);
Als (oldcolor == groen) tft.fillRect (BOXSIZE * 3, BOXSIZE * 0, BOXSIZE, BOXSIZE, groen);
Als (oldcolor == cyaan) tft.fillRect (BOXSIZE * 2, BOXSIZE * 0, BOXSIZE, BOXSIZE, cyaan);
Als (oldcolor == blauw) tft.fillRect (BOXSIZE * 1, BOXSIZE * 0, BOXSIZE, BOXSIZE, blauw);
Als (oldcolor == MAGENTA) tft.fillRect (BOXSIZE * 0, BOXSIZE * 0, BOXSIZE, BOXSIZE, MAGENTA);
}
}
Als (((p.y-PENRADIUS) > BOXSIZE) & & ((p.y+PENRADIUS) < tft.height())) {}
tft.fillCircle (p.x, p.y, PENRADIUS, currentcolor);
}