hello everyone i have one big problem and i try to fix 10 days now but with no effect.
i want to see the temperature from lm35 to tft 1.8'' all good but my problem is after refresh the numbers at tft from lm is flashing if the delay is small about 250ms flashing is all the time only the numbers of temperature i try to fix but the flashing of temperature is there and i hate this cant you tell what is the wrong of my code and what chanse i do to fix this flashing??
Thanks a lot.
// Arduino LCD library
#include <TFT.h>
#include <SPI.h>
// pin definition for the Uno
#define cs 10
#define dc 9
#define rst 8
// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);
const int water_Pin = A0;
const int oil_Pin = A2;
const int LED_Pin = 2;
const int threshold = 316;
int Input_Value = 0;
// char array to print to the screen
char sensorwater[4];
char sensoroil[4];
void setup() {
analogReference(INTERNAL);
pinMode(2, OUTPUT);
// Put this line at the beginning of every sketch that uses the GLCD:
TFTscreen.begin();
// clear the screen with a black background
TFTscreen.background(0, 0, 0);
// write the static text to the screen
// set the font color to white
TFTscreen.stroke(255, 255, 255);
// set the font size
TFTscreen.setTextSize(2);
// write the text to the top left corner of the screen
TFTscreen.text("Water Temp\n " , 25 ,0);
TFTscreen.text("C", 95, 20);
TFTscreen.text("Oil Temp\n" ,35 ,60);
TFTscreen.text("C", 95, 80);
// ste the font size very large for the loop
TFTscreen.setTextSize(5);
}
void loop() {
// print the sensor value
String water = String(analogRead(A0)*1.1*100/1024);
String oil = String(analogRead(A2)*1.1*100/1024);
water.toCharArray(sensorwater, 4);
oil.toCharArray(sensoroil, 4);
TFTscreen.stroke(255, 255, 255);
TFTscreen.text(sensoroil, 0, 80);
TFTscreen.text(sensorwater, 0, 20);
delay (250);
TFTscreen.stroke(0, 0, 0);
TFTscreen.text(sensoroil, 0, 80);
TFTscreen.text(sensorwater, 0, 20);
}