Skip to content

Instantly share code, notes, and snippets.

@companje
Created May 18, 2024 15:00
Show Gist options
  • Save companje/f7b037f08be484d83380f88a006fe8be to your computer and use it in GitHub Desktop.
Save companje/f7b037f08be484d83380f88a006fe8be to your computer and use it in GitHub Desktop.
TFT show formula
#include <stdint.h>
#include <TouchScreen.h>
#include <TFT.h>
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A1 // must be an analog pin, use "An" notation!
#define YM 14 // can be a digital pin, this is A0
#define XP 17 // can be a digital pin, this is A3
// String msg = "Hello String";
int colors[] = {RED,GREEN,YELLOW, WHITE};
char msg[] = "=SUM(A1:A15)";
char c[] = "x" ;
int w=18;
int h=30;
int cols=320/w;
int color = WHITE;
void setup() {
Tft.init();
Tft.setDisplayDirect(DOWN2UP);
for (int i=0; i<sizeof(msg); i++) {
c[0] = msg[i];
color = (i>4 && i<11) ? YELLOW : WHITE;
Tft.drawString(c,(i/cols)*h,320-(i%cols)*w,3,color);
}
}
void loop()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment