Hello everyone,
I’m a beginner, I need to insert a floating float on the 16x2 LCD via the 4x4 keypad. Can someone help me?

I’m having a hard time trying to figure out how to put a decimal point in an array, and how to make sure there is only 1 decimal point at a time.

``````#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#define analogPin 0

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

char state = 1;
int setpointpHMax;
int setpointCEMax;
int num = 1;
void setup() {
Wire.begin();
lcd.begin(16, 2);     //
Serial.begin(9600);
}

void loop()
{

if (Key != KEY_NOT_PRESSED)

switch (state)
{
case 1:
switch (Key) {
case 'A':
lcd.clear(); Set_state(4);
break;
case 'B':
lcd.clear(); Set_state(2);
break;
default:
Set_state(1);
}
break;

case 2:
switch (Key) {
case 'A':
lcd.clear(); Set_state(1);
break;
case 'B':
lcd.clear(); Set_state(3);
break;
default:
Set_state(2);
}
break;

case 3:
switch (Key) {
case 'A':
lcd.clear(); Set_state(2);
break;
case 'B':
lcd.clear(); Set_state(4);
break;
default:
Set_state(3);
}
break;

case 4:
switch (Key) {
case KEY_NOT_PRESSED:
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case '.':
//lcd.setCursor(0,0);
//lcd.print(Key);
num = num * 10 + (Key - 58); // Here the function that prints the variable on the LCD
//lcd.setCursor(0, 1);
//lcd.print(num);
break;
case 'D':
num = 0;
lcd.clear();
break;
case 'A':
lcd.clear(); Set_state(3);
break;
case 'B':
lcd.clear(); Set_state(1);
break;
default:
Set_state(4);
}
break;
default:;
}
}
void Set_state(char index)
{
state = index;

switch (state)
{
case 1: //==================== state 1

lcd.setCursor(1, 0);
lcd.print ("-Hidro V 1.0-");
lcd.setCursor(0, 1);
lcd.print ("--NDS Projetos--");
break;

case 2: //==================== state 2

lcd.setCursor(3, 1);
lcd.print("dgsdgsdg");
lcd.setCursor(0, 0);
break;

case 3: //==================== state 3

lcd.setCursor(1, 0);
lcd.print(" Set Point Max");
lcd.setCursor(0, 1);
lcd.print("CE:");
lcd.print(    setpointCEMax, DEC);
lcd.print("   dS/m");
break;

case 4: //==================== state 4
lcd.setCursor(1, 0);
lcd.print(" Set Point Max");
lcd.setCursor(0, 1);
lcd.print("pH:");
lcd.print( num, DEC);
lcd.print("   dS/m");
break;
}
}
``````