Components and supplies
Jumper wires (generic)
Breadboard (generic)
Resistor 10k ohm
1.44" Colorful SPI TFT LCD Display ST7735 128X128 Replace Nokia 5110/3310 LCD
Arduino UNO
Original New Touch Screen for Konica Minolta Bizhub C224 C284 C364 C554 C654 C754 control Panel
Apps and platforms
Arduino IDE
Project description
Code
Source Code
arduino
1#include <Wire.h> //Connect Konica Minolta touch screen SDA to A04 and SCK to A05 2#include <Adafruit_GFX.h> //Core graphics library 3#include <Adafruit_ST7735.h> //Hardware-specific library 4#include <SPI.h> 5 6#define TFT_SCLK 13 7#define TFT_MOSI 11 8#define TFT_CS 10 9#define TFT_RST 9 10#define TFT_DC 8 11 12Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); 13 14byte register1; 15byte register2; 16byte register3; 17byte register4; 18byte register5; 19byte register6; 20byte register7; 21byte register8; 22byte register9; 23byte register10; 24byte register11; 25 26int xx1, xx2, yy1, yy2, r, x, y; //variables 27 28void setup() { 29 tft.initR(INITR_REDTAB); //initialize a ST7735S chip, black tab 30 tft.fillScreen(ST7735_BLACK); //clear screen 31 Wire.begin(0x5c); //join i2c bus (address optional for master) 32 //Serial.begin(115200); //start serial for output 33 //Serial.println("starting"); //print "starting" to serial 34} 35 36void loop() { 37 Wire.beginTransmission(0x5C); //touch panel address 38 Wire.write(0x00); //start register 39 Wire.endTransmission(); //communication close 40 Wire.requestFrom(0x5c, 11); //how many byte to read from address 0x5C 41 42 register1 = Wire.read(); //first byte reading (Touch counter) 43 register2 = Wire.read(); //second reading (????) 44 register3 = Wire.read(); //etc etc etc (first finger X coordinate low byte) 45 register4 = Wire.read(); //first finger X coordinate high byte 46 register5 = Wire.read(); //first finger Y coordinate low byte 47 register6 = Wire.read(); //first finger Y coordinate high byte 48 register7 = Wire.read(); //?? 49 register8 = Wire.read(); //second finger X coordinate low byte 50 register9 = Wire.read(); //second finger X coordinate high byte 51 register10 = Wire.read(); //second finger Y coordinate low byte 52 register11 = Wire.read(); //second finger Y coordinate high byte 53 54 55 xx1 = (register4 * 256) + register3; //calculate 2 byte to touch coordinate (0-1024) 56 yy1 = (register6 * 256) + register5; //calculate 2 byte to touch coordinate (0-600) 57 xx2 = (register9 * 256) + register8; //calculate 2 byte to touch coordinate (0-1024) 58 yy2 = (register11 * 256) + register10; //calculate 2 byte to touch coordinate (0-600) 59 60 xx1 = xx1 / 8; //divide by 8 to scale 128x128 61 xx1 = 128 - xx1; 62 63 yy1 = yy1 / 4.6875; //divide by 4.6 to scale 128x128 64 yy1 = 128 - yy1; 65 66 xx2 = xx2 / 8; 67 xx2 = 128 - xx2; 68 69 yy2 = yy2 / 4, 6875; 70 yy2 = 128 - yy2; 71 72 //x= xx1 - xx2; //calculate radius 73 //y= yy2 - yy2; 74 75 //x= x*x; //pythagoras 76 //y= y*y; 77 //r = x +y; 78 //r= sqrt(r); 79 80 //Serial.print("Touch counter:"); 81 //Serial.println(register1); 82 //Serial.print("First finger horinzontal (X) coordinate:"); 83 //Serial.println(xx1); 84 85 //Serial.print("First finger vertical (Y) coordinate:"); 86 //Serial.println(yy1); 87 88 //Serial.print("Second finger horinzontal (X) coordinate:"); 89 //Serial.println(xx2); 90 91 //Serial.print("Second finger vertical (Y) coordinate:"); 92 //Serial.println(yy2); 93 94 tft.drawPixel(xx1, yy1, ST7735_WHITE); //write dots to screen first finger 95 96 tft.drawPixel(xx2, yy2, ST7735_GREEN); //write dots to screen second finger 97 98 //Draw line between two finger 99 //tft.drawLine(xx1,yy1,xx2,yy2, ST7735_WHITE); // test 100 101 //Draw dot for first finger and draw circle with radius between first and second finger disatance 102 //if (register1 <= 1) { //test 103 // tft.drawPixel(xx1, yy1, ST7735_WHITE); //test 104 //} //test 105 //else {tft.drawCircle (xx1,yy1,r,ST7735_BLUE); //test 106 //} //test 107 //delay(100); //test 108 109 } 110
Source Code
arduino
1#include <Wire.h> //Connect Konica Minolta touch screen SDA to A04 and SCK to A05 2#include <Adafruit_GFX.h> //Core graphics library 3#include <Adafruit_ST7735.h> //Hardware-specific library 4#include <SPI.h> 5 6#define TFT_SCLK 13 7#define TFT_MOSI 11 8#define TFT_CS 10 9#define TFT_RST 9 10#define TFT_DC 8 11 12Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); 13 14byte register1; 15byte register2; 16byte register3; 17byte register4; 18byte register5; 19byte register6; 20byte register7; 21byte register8; 22byte register9; 23byte register10; 24byte register11; 25 26int xx1, xx2, yy1, yy2, r, x, y; //variables 27 28void setup() { 29 tft.initR(INITR_REDTAB); //initialize a ST7735S chip, black tab 30 tft.fillScreen(ST7735_BLACK); //clear screen 31 Wire.begin(0x5c); //join i2c bus (address optional for master) 32 //Serial.begin(115200); //start serial for output 33 //Serial.println("starting"); //print "starting" to serial 34} 35 36void loop() { 37 Wire.beginTransmission(0x5C); //touch panel address 38 Wire.write(0x00); //start register 39 Wire.endTransmission(); //communication close 40 Wire.requestFrom(0x5c, 11); //how many byte to read from address 0x5C 41 42 register1 = Wire.read(); //first byte reading (Touch counter) 43 register2 = Wire.read(); //second reading (????) 44 register3 = Wire.read(); //etc etc etc (first finger X coordinate low byte) 45 register4 = Wire.read(); //first finger X coordinate high byte 46 register5 = Wire.read(); //first finger Y coordinate low byte 47 register6 = Wire.read(); //first finger Y coordinate high byte 48 register7 = Wire.read(); //?? 49 register8 = Wire.read(); //second finger X coordinate low byte 50 register9 = Wire.read(); //second finger X coordinate high byte 51 register10 = Wire.read(); //second finger Y coordinate low byte 52 register11 = Wire.read(); //second finger Y coordinate high byte 53 54 55 xx1 = (register4 * 256) + register3; //calculate 2 byte to touch coordinate (0-1024) 56 yy1 = (register6 * 256) + register5; //calculate 2 byte to touch coordinate (0-600) 57 xx2 = (register9 * 256) + register8; //calculate 2 byte to touch coordinate (0-1024) 58 yy2 = (register11 * 256) + register10; //calculate 2 byte to touch coordinate (0-600) 59 60 xx1 = xx1 / 8; //divide by 8 to scale 128x128 61 xx1 = 128 - xx1; 62 63 yy1 = yy1 / 4.6875; //divide by 4.6 to scale 128x128 64 yy1 = 128 - yy1; 65 66 xx2 = xx2 / 8; 67 xx2 = 128 - xx2; 68 69 yy2 = yy2 / 4, 6875; 70 yy2 = 128 - yy2; 71 72 //x= xx1 - xx2; //calculate radius 73 //y= yy2 - yy2; 74 75 //x= x*x; //pythagoras 76 //y= y*y; 77 //r = x +y; 78 //r= sqrt(r); 79 80 //Serial.print("Touch counter:"); 81 //Serial.println(register1); 82 //Serial.print("First finger horinzontal (X) coordinate:"); 83 //Serial.println(xx1); 84 85 //Serial.print("First finger vertical (Y) coordinate:"); 86 //Serial.println(yy1); 87 88 //Serial.print("Second finger horinzontal (X) coordinate:"); 89 //Serial.println(xx2); 90 91 //Serial.print("Second finger vertical (Y) coordinate:"); 92 //Serial.println(yy2); 93 94 tft.drawPixel(xx1, yy1, ST7735_WHITE); //write dots to screen first finger 95 96 tft.drawPixel(xx2, yy2, ST7735_GREEN); //write dots to screen second finger 97 98 //Draw line between two finger 99 //tft.drawLine(xx1,yy1,xx2,yy2, ST7735_WHITE); // test 100 101 //Draw dot for first finger and draw circle with radius between first and second finger disatance 102 //if (register1 <= 1) { //test 103 // tft.drawPixel(xx1, yy1, ST7735_WHITE); //test 104 //} //test 105 //else {tft.drawCircle (xx1,yy1,r,ST7735_BLUE); //test 106 //} //test 107 //delay(100); //test 108 109 } 110
Downloadable files
Schematic
Schematic
Schematic
Schematic
Schematic
Schematic
Comments
Only logged in users can leave comments
DoubleG
0 Followers
•0 Projects
Table of contents
Intro
2
0