Need a better way to slow down input to lcd other then delay()

Hi, I'm using max31855 with k type tc to display temp on lcd. My original code uses delay(1000); after showing the value from the tc to slow it down a bit.

My problem is now that I have other things going on and that extra 1 second delay is messing it up. Is there any better way to do this without delaying the whole void loop()? I wouldn't even know what to search for.

Thanks guys!

Check out the "blink without delay" sample code in the playground.

Good call. I meant to say output haha! I try to search first but not sure what to search for sometimes. Thanks alot!

Hi again,

I tried it and its working although the temp is blinking on on the lcd instead of updating every second. I'll check it more when I get home tonight.

I came up with most elegant solution but haven't tested yet. Don't mind case on phone it sucks.

Int loopcounter =0;

If loopcounter=10

LCD.print(temp)
Loop counter=0

Else

Loop counter =loopcounter + 1

You get the idea. Stupid phone argh...

Depend on where you put that code, loopcounter could increment from 0 to 10 in nothing flat. On the other hand, loopcounter may never increment past 1.

I'd suggest that you need to try again. The millis() function could prove useful.

I should have waited until I got home to PC. Typing code with phone sucks... Glad you kinda got where I was going with it.

My idea above is to basically have a counter that increments by 1 every time the loop runs then when the counter reaches whatever number it will update the lcd with what I want and clear the counter. I'm going to test after a few beers but I'm sure it'll work.

Its actually working just fine now but the sketch updates the info on the lcd too fast. Slowing it down like this should be cake. I will update this thread and thanks for your reply. :slight_smile:

I get good ideas in the shower lol. Isn't that weird?

Well, its working just like I thought but there's another problem. When input temp reaches over 100 it works fine. When it goes back down the extra character after the two spaces stays there. I tried to fix it... Looks like maybe I'll be going another route. It looked perfect though with counter only at 5. Temp was updated around every second or so. Maybe a little faster but it looked perfect. :slight_smile:

I'll update even if no one reads. Maybe someone down the road will?

Well, same problem with millis() function as blink without delay sketch.... Updates LCD just fine every second but clears the characters....

EDIT:I'm a noob that's what happening hahahaha! I had an lcd.clear() in the void loop. The same thing is happening with every different way of doing it. Ends up being extra characters on the display after output to lcd is < 100. Say old temp was 118 and next temp was 88. Display shows 888. Its hard being a noob lolol.

I used my original code and got rid of the lcd.clear() in the void loops and it acts exactly like it did with all the other tries after removing it(lcd.clear).

Any ideas?

lcd.print(temp) then lcd.print(" ") to get rid of the last digit from the previous value if it is there.

noobdude:
Any ideas?

Not without being able to see your code :wink:

Thanks guys! sending lcd.print(" ") to the right spot when temp is less than 100 is working. :slight_smile:

I'm not near lappy but if anyone is still interested I can post code.

A very cool member pointed out a much better way to do it. Simply clear where the extra character would be every time temp is printed. Looks great.

lcd.setCursor(19, 4);
lcd.print(" ");
lcd.setCursor(17, 4);
lcd.print(temp);

NICE!

What I actually had in mind was

     lcd.setCursor(17, 4);
     lcd.print(temp);
     lcd.print(" ");

No need to position the cursor before printing the space. This will work as long as temp has 2 or 3 digits.

Sweet!