polargraph_arduino/libraries/UTouch/examples/Arduino/UTouch_QuickDraw/UTouch_QuickDraw.pde

49 lines
1.1 KiB
Plaintext

// UTouch_QuickDraw (C)2010-2012 Henning Karlsen
// web: http://www.henningkarlsen.com/electronics
//
// This program is a quick demo of how to use the library.
//
// This program requires the UTFT library.
//
// It is assumed that the display module is connected to an
// appropriate shield or that you know how to change the pin
// numbers in the setup.
//
#include <UTFT.h>
#include <UTouch.h>
// Uncomment the next two lines for the Arduino 2009/UNO
//UTFT myGLCD(ITDB24D,19,18,17,16); // Remember to change the model parameter to suit your display module!
//UTouch myTouch(15,10,14,9,8);
// Uncomment the next two lines for the Arduino Mega
UTFT myGLCD(ITDB32S, 38,39,40,41); // Remember to change the model parameter to suit your display module!
UTouch myTouch(6,5,4,3,2);
void setup()
{
myGLCD.InitLCD();
myGLCD.clrScr();
myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
}
void loop()
{
long x, y;
while (myTouch.dataAvailable() == true)
{
myTouch.read();
x = myTouch.getX();
y = myTouch.getY();
if ((x!=-1) and (y!=-1))
{
myGLCD.drawPixel (x, y);
}
}
}