Sinewave pe TFT 3.2” (SSD1289) si Arduino

#include <UTFT.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];// Uncomment the next line for Arduino 2009/Uno
UTFT myGLCD(ITDB32S,19,18,17,16); // Remember to change the model parameter to suit your display module!// Uncomment the next line for Arduino Mega
// UTFT myGLCD(ITDB24E_16,38,39,40,41); // Remember to change the model parameter to suit your display module!void setup()
{
randomSeed(analogRead(0));// Setup the LCD
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);
}void loop()
{
int buf[318];
int x, x2;
int y, y2;
int r;// Clear the screen and draw the frame
myGLCD.clrScr();myGLCD.setColor(255, 0, 0);
myGLCD.fillRect(0, 0, 319, 13);
myGLCD.setColor(64, 64, 64);
myGLCD.fillRect(0, 226, 319, 239);
myGLCD.setColor(255, 255, 255);
myGLCD.setBackColor(255, 0, 0);
myGLCD.print(“* SIN / COS / TAN – SSD1289 *”, CENTER, 1);
myGLCD.setBackColor(64, 64, 64);
myGLCD.setColor(255,255,0);
myGLCD.print(“<http://electronicaupit.com/forum>”, CENTER, 227);myGLCD.setColor(0, 0, 255);
myGLCD.drawRect(0, 14, 319, 225);// Draw crosshairs
myGLCD.setColor(0, 0, 255);
myGLCD.setBackColor(0, 0, 0);
myGLCD.drawLine(159, 15, 159, 224);
myGLCD.drawLine(1, 119, 318, 119);
for (int i=9; i<310; i+=10)
myGLCD.drawLine(i, 117, i, 121);
for (int i=19; i<220; i+=10)
myGLCD.drawLine(157, i, 161, i);// Draw sin-, cos- and tan-lines
myGLCD.setColor(0,255,255);
myGLCD.print(“Sin”, 5, 15);
for (int i=1; i<318; i++)
{
myGLCD.drawPixel(i,119+(sin(((i*1.13)*3.14)/180)*95));
}myGLCD.setColor(255,0,0);
myGLCD.print(“Cos”, 5, 27);
for (int i=1; i<318; i++)
{
myGLCD.drawPixel(i,119+(cos(((i*1.13)*3.14)/180)*95));
}myGLCD.setColor(255,255,0);
myGLCD.print(“Tan”, 5, 39);
for (int i=1; i<318; i++)
{
myGLCD.drawPixel(i,119+(tan(((i*1.13)*3.14)/180)));
}delay(10000);
}