jock 2
tft.fillScreen(BLACK); very slow =(
// art100 write message
//TOUCH PCB ARDUINO UNO
//YU 13 A1
//XL 12 6
//YD 15 7
//XR 14 A2
//TFT
//A
//K1
//K2
//K3
//K4
#include "TFTLCD.h"
//pins
#define LCD_RESET A4
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
const int analogInPin = A5; // Analog input pin that the potentiometer is attached to
//const int analogInPin = A4; // :(
//const int analogInPin = A3;// :(
//const int analogInPin = A2;// :(
//const int analogInPin = A1;// :(
//const int analogInPin = A0;// :(
//const int analogInPin = A-1;// ;)
//const int analogInPin = A-2;// ;)
//const int analogInPin = A-3;// ;)
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
//-----------------------
void setup(void) {
Serial.begin(9600);
Serial.println("8 Bit LCD test! more pinssssss");
tft.reset();
tft.initDisplay();
tft.fillScreen(BLACK); // very slooooooow
// testtext(YELLOW);
}
//===================
void loop(void) {
// tft.initDisplay();
tft.fillScreen(BLACK); // very slooooooow
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
// outputValue = map(sensorValue, 0, 1023, 0, 255);
outputValue = map(sensorValue, 0, 1023, 0, 240);//lcd 320x240
// print the results to the serial monitor:
Serial.print("sensor = " ); Serial.print(sensorValue); Serial.print("\t output = "); Serial.println(outputValue);
for (uint16_t y=0; y<tft.height(); y+=10) {
if(180<outputValue) {tft.drawHorizontalLine( 0, y, outputValue, RED);}
else{ tft.drawHorizontalLine( 0, y, outputValue, GREEN);}
}
Serial.println("tft.drawHorizontalLine(125, y, pin analog A5 only , GREEN);");
delay(1000);
//delay(1);
}