Hi everybody.
I'm trying to compare 2 floats value, I've read a couple of forums and I understand that since my values are floats, they have a lots of number after the comma so that's why they can't be compared, let's say that I want to have a value of 2 number after the comma, how do I achieve that?
Right now here's my code, I'm checking an ADC and compare to an old value, if there a change I update a TFT screen.
// Print the result from the ADC
// Voltage Out
float voltage2 = readAdc(2);
float ADCVOUT = (((voltage2 / 5) * MaxVoltagePSU) * 2.44);
if (ADCVOUT != adcvoutOLD) {
tft.fillRect(47,120,37,12,ST7735_BLACK);
tft.setTextSize(1);
tft.setCursor(50,122);
tft.print(ADCVOUT);
tft.print("V");
float adcvoutOLD = ADCVOUT;
}
That's it, any help would be appreciated.