Counting up using LCD and perform calculation

Hi everyone, I am new to Arduino programming. My condition is I want to counting up a value of i from 0 to infinity. At the same time, a calculation, b is needed to be performed when counting up the value. Can anyone can help me on it? Thanks. :slight_smile: :slight_smile: :slight_smile:

#include <LiquidCrystal.h>

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

void setup() {
  lcd.begin(16, 2);
}

void loop() {
  
  int i=0;
  
  while (i>0){
    i++;
    lcd.setCursor(3,1);
    lcd.print(i);
  }

  b = i*2;
  lcd.print(b);
  
}

Why not put the calculation and print inside the while loop? You may need to adjust the LCD print position.

groundFungus:
Why not put the calculation and print inside the while loop? You may need to adjust the LCD print position.

After I add the calculation part into while loop, my counting, i will start from 90. How can I change the code so that the i will start from 0?

I want to counting up a value of i from 0 to infinity

Which Arduino board do you aim to use for the upper end of that range ?

lai41:
My condition is I want to counting up a value of i from 0 to infinity.

Which Arduino are you using, most of them have limited memory, and to run a counter that goes to infinity would require an infinite amount of memory.

...and rather more than an infinite amount of time.

UKHeliBob:
Which Arduino board do you aim to use for the upper end of that range ?

I am not understood with your question. Can you explain to me again? Thanks

srnet:
Which Arduino are you using, most of them have limited memory, and to run a counter that goes to infinity would require an infinite amount of memory.

I am using the Arduino UNO. I have done with the counting up part. However, I have encountered another part, after I put the calculation part, b into the while loop. The counting part will start from 90 instead of 0. Can I know how can I solve this? Thanks.

The code you posted cannot possibly compile.

Please stop wasting time.