Switch Button for variables on LCD

:frowning: >:( >:( >:( >:( >:( >:( >:( >:( >:( >:( >:( >:(

I have been working for days on this project, and I still haven’t been able to Write a code to make it work…

I am trying to make an LCD display a values coming from many different sensors I have set up. I have all the sensors ready, and working. The issue I am facing is the coding… I have a 16X2 LCD. Cannot fit more more than 32 characters on the display. I also would like to expand my mind with coding/electronics. So I am not considering getting a larger LCD (don’t have anymore money too) ;(.

So after thinking for a while I thought I could use a push button to change what sensor value was being displayed on the screen. Every push changes the displayed values. each display is assigned a value. Every push sends a High signal to a Digital Input pin. Every time the pin goes high, a variable gets 1 added it. So X starts out at 0. The pin goes high, X=(X+1) , X=1, and so on. If X reaches a value that is not assigned to a display setting, X will be set back to 0. By using “If else” statements I though I could set these all on the display of the LCD…

Here is what I came up with so far…

It keeps giving me this message

“sketch_jan10c.ino: In function ‘void loop()’:
sketch_jan10c:33: error: expected ;' before '}' token sketch_jan10c:47: error: expected ;’ before ‘{’ token”

What am I doing wrong?

I know my coding may not be the best, I am still getting used to this. So please bear with me.

Any help would be well appreciated!

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 

int l=0;//Light sensor
int t=1;//Tempauture sensor
int f=2;//Force sensor

int L;//Light value
int T;//Tempuratue value
int F;//Force value

int b=2;//pin for digital Input
int B;//value for input being HIGH or LOW

int i=0;//value for switching on push button 

void setup () {
  lcd.begin(16,2); 
  Serial.begin(9600);
  pinMode(b, INPUT);
  
}

void loop() {
  L=analogRead(l);  
  T=analogRead(t);  
  F=analogRead(f); 
  B=digitalRead(b);
  
  if (i >= 3) {
    (i==i*0)
  }
  
  if (B == HIGH) {
    (i==i+1);
  }
  
  if (i==0){
    lcd.print("Light Value:");
    lcd.print(L * 0.0977517107);
  }
  else if (i==1){
     lcd.print("Temp:");
    lcd.print(((T*0.00488758553)/.1));
  }
   else (i==2) { 
  lcd.print("Force:");
    lcd.print(F * 0.0977517107);
  }   
}

Remember to set the cursor before writing (or clear the LCD)

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int l = 0; //Light sensor
int t = 1; //Tempauture sensor
int f = 2; //Force sensor

int L;//Light value
int T;//Tempuratue value
int F;//Force value

int b = 2; //pin for digital Input
int B;//value for input being HIGH or LOW

int i = 0; //value for switching on push button

void setup ()
{
  lcd.begin(16, 2);
  Serial.begin(9600);
  pinMode(b, INPUT);
}

void loop()
{
  L = analogRead(l);
  T = analogRead(t);
  F = analogRead(f);
  B = digitalRead(b);

  if (B == HIGH) {i = i + 1; delay(300);}
  if (i >= 3)  i = 0;
  if (i == 0)
  {
    lcd.print("Light Value:");
    lcd.print(L * 0.0977517107);
  }
  else if (i == 1)
  {
    lcd.print("Temp:");
    lcd.print(((T * 0.00488758553) / .1));
  }
  else if (i == 2)
  {
    lcd.print("Force:");
    lcd.print(F * 0.0977517107);
  }
}