Created
May 18, 2024 15:00
-
-
Save companje/f7b037f08be484d83380f88a006fe8be to your computer and use it in GitHub Desktop.
TFT show formula
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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