Hey, I am building an underwater sensor that has pH, temp, dissolved oxygen, and depth. All of these create analog values to be calculated into their respective values. I am trying to print all of the values on the ST7565 Adafruit screen. When calculated, the values are floats, but therefore cannot be displayed on the LCD because it does not display Floats. Does anyone have any suggestions on how to convert these values into something that can be displayed on the screen? Here is an example of the code i have for displaying the pH
(i know that the glcd.drawstring(50,0,pH) will not work because the pH is currently a float, but that is the section that I would like to workout!)
#include "ST7565.h"
#include "math.h"
#include "stdio.h"
#define exp
#define a1 0.391988367
#define a0 2.51792
ST7565 glcd(9, 8, 7, 6, 5);
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
void setup () {
Serial.begin(9600);
}
void loop() {
float raw=log(10000.0*((1024.0/analogRead(3)-1)));
float kelvin=1/(0.001405+(0.0002368+(0.0000001013*raw*raw))*raw);
float Temp= kelvin-273.15;
Serial.println(Temp);
delay(1000);
float Count2=0;
float Voltage2;
float pH;
float ft= 1.0732-(0.0039093*Temp)+(0.000012333*pow(Temp, 2));
Count2=analogRead(2);
//Serial.println(Count2);
Voltage2=(Count2/1024)*5;
pH=(((ft*(Voltage2-a0))/a1)+7);
delay(1000);
glcd.drawstring(50,0,pH);
glcd.display();
}