Go Down

Topic: Tft graph (Read 242 times) previous topic - next topic

newsogn

Hello,

So I am trying to make a data logger with color tft display. I want it to graph the values in real time. My tft display is a 320x240 2.8" shield I got from amazon. But it uses the adafruit graphics library so that seems to be pretty standard. So my question is wheather or not people know of any resources, maybe someone else has already done it, i just cant find any code for it.
Thanks,
Brad

Nick_Pyner

There should be a library for it from the same supplier, and a graphic demo included therein - most likely a sine wave. Typically you would advance the x-coordinate once every trip round the loop, say 1 sec and the Y-coord is a convenient multiple of the value

KrisKasprzak

I have a very similar display and wrote some graphing functions (Cartesian and bar graphs)

YouTube video shows them in action with links to source code

https://www.youtube.com/watch?v=YejRbIKe6e0

https://www.youtube.com/watch?v=U5hOU-xxQgk

Enjoy

Kris
Thanks,

Kris

newsogn

wow that is really cool!!! thank you I will use that.

Something simple that I did come up with myself is:

void loop() {
  tft.setRotation(1);
 

for (Xpos = 108; Xpos < 320; Xpos++){
Ypos = 50*sin(Xpos*12.5)+120;

tft.fillRect(Xpos+1,0,5,230,BLACK);
tft.fillCircle(Xpos,Ypos,1,RED);
delay(50);
}
}

Super Simple but it is great!!!!

Go Up