TFT to serial plotter

Hi

This code displays on TFT screen XY graph, how to modify it to be able sithis graph on serial monitor ?

/***************************************************

  This sketch implements a simple XY display

  You can get this file from:
    https://github.com/mjoldfield/xy-arduino-toy
  or read more at:
    http://mjoldfield.com/atelier/2015/11/cheap-xy-display.html

 

  This is an example sketch for the Adafruit 2.2" SPI display.
  This library works with the Adafruit 2.2" TFT Breakout w/SD card
  ----> http://www.adafruit.com/products/1480
 
  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/
 
#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()
{
 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(void) 
{
    if (digitalRead(2) == LOW)
  {
    tft.fillScreen(ST77XX_BLUE);
  }
  int x = analogRead(36);
  int y = analogRead(39);
  
 // tft.drawPixel(x >> 2, 240 - (y >> 2), ST77XX_GREEN);
   tft.drawPixel(x >> 2, 100 - (y >> 2), ST77XX_GREEN);
}

You may have trouble here because the X dimension in the serial plotter is an implied time line.
What are you reading on pin 36 ?

don't know if your just trying to do something "cool" or real analysis of data?

on some projects i've dumped data to the serial monitor, copied it into a file. i used Xgraph to view the data if it's in x-y format, other wise i used a script to reformat it possibly for multiple plots on the same x-axis for analysis. Xgraph allows you to zoom in/out to see details

Lissajous curve maybe?

= yes, Lissajous on serial plotter

The plotter 'x' axis moves in the positive direction only. Can you graph a Lissajous with time as the 'x' input?