Hi Here is the code for Ux Uy display on tft screen, but it is showing the dots, I need in continuous line.
How to fix it ?
#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#include <SPI.h>
#define TFT_MOSI 23 // Data out
#define TFT_SCLK 18 // Clock out
#define TFT_CS 22// // Chip select pin
#define TFT_DC 21 // Data/Command pin
#define TFT_RST -1 // pin# 2
// Create an instance of the display driver
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
int DCX1, DCX2, DCY1, DCY2;
byte lastButtonState = LOW;
int botonState = 0;
void setup() {
Serial.begin(115200);
pinMode(2, INPUT_PULLUP); //Sw, Bst = botonState
tft.init(170, 320);
tft.setRotation(3); // Adjust rotation as needed (0-3),0 = viertical, 1= horyzontal upside down, 2= viertical 180 deg , 3=horyzontal normal,
// Clear the screen
//tft.fillScreen(ST77XX_BLACK);//++++++++++++++++++++++++++++++++
tft.fillScreen(ST77XX_BLUE);
tft.setTextWrap(false); // Disable text wrapping
tft.setTextSize(4); // Set text size
// tft.setTextColor(ST77XX_WHITE); // Set text color +++++++++++++++++++
tft.setTextColor(ST77XX_YELLOW); // Set text color
}
void loop() {
if (digitalRead(2) == LOW)
{
tft.fillScreen(ST77XX_BLUE);
}
DCX1 = analogRead(13);
// DCX1 = analogRead(39);
DCX1 = map(DCX1, 0, 4096, 0, 3300);
// DCX1 = DCXp(DCX1, 0, 4096, 0, 500);
DCX2 = 3299 - DCX1;
DCY1 = analogRead(15);
// DCY1 = analogRead(39);
DCY1 = map(DCY1, 0, 4096, 0, 3300);
// DCY1 = DCYp(DCY1, 0, 4096, 0, 500);
DCY2 = 3299 - DCY1;
if (digitalRead(14) == LOW)
{
tft.fillScreen(ST77XX_BLUE);
}
tft.setCursor(10, 0);
tft.setTextColor(ST77XX_YELLOW);
tft.print("C 6");
tft.fillRect(150 + (DCX1 / 23), 150 - (DCY1 / 23), 3 , 3, ST77XX_WHITE);
Serial.print("case 6 = ");
Serial.print( "DCY1 = "); Serial.print( DCX1);
Serial.print(" DCY1 = "); Serial.print( DCY1);
Serial.println( );
}


