Hi. Im an Arduino Rookie.
How can i compare the actualValue and the lastValue. In IF i cant compare string..
What can i do? Thanks in advance.
char printout[4];
byte led = 5;//byte: 8 bit (0-255)
#include <TFT.h>
#include <SPI.h>
#define CS 7
#define DC 0
#define RESET 1
TFT screen = TFT(CS, DC, RESET);
void setup() {
// put your setup code here, to run once:
pinMode(5, OUTPUT);
Serial.begin(9600);
screen.begin();
screen.background(5, 5, 50);
screen.stroke(255, 255, 255); //Weiß
screen.text("VOLT", 0, 30);
screen.setTextSize(3);
screen.stroke(255, 0, 0); //Rot
screen.line(0, 40, screen.width(), 40);
}
void loop() {
// put your main code here, to run repeatedly:
String actualValue = String(10.0 / 1023 * analogRead(A1));
actualValue.toCharArray(printout,4);
String lastValue = String(10.0 / 1023 * analogRead(A1));
lastValue.toCharArray(printout,4);
Serial.println((10.0 / 1023 * analogRead(A1))); //Serial Monitor
Serial.println(actualValue);
Serial.println(lastValue);
if (analogRead(A1) < 900 && (analogRead(A1) > 50))
(digitalWrite(led, LOW));
else
(digitalWrite(led, HIGH));
if (actualValue > lastValue1.05&&actualValue < lastValue0.95)
{ screen.stroke(255, 255, 255);
screen.text(printout, 0, 0);
lastValue=actualValue;
screen.stroke(255, 255, 255);
screen.text(printout, 0, 0);
}
}