Hi all
I'm working on building a homebrew beer, fermentation temperature controller with a fancy lcd display and menu/input system and using the PID library to control the output and maintain a stable temperature.
I'm still very much learning how to write code but feel like i've come a long way. I've come across a lot of problems and with the help of professors google and YouTube i've been able to solve just about all of these problems for myself. So far, it's coming along just swimmingly. However, i've come across one problem that i just can not crack.
I've come up with a way to adjust and enter the PID library values to one decimal place. When i press the up or down button to adjust the value, it increments or decrements by 0.1. The problem i'm having is that when i increment or decrement the value, the value adjusts correctly, but when the value reaches 2.1, the lcd display stalls for 1 increment. In other words, the value adjusts correctly up to 2.2 but the lcd displays 2.1 and then continues .1 behind the actual value all the way up until 9.2. Then it skips 9.3 altogether and displays 9.4. Then the LCD and value remain synched again. When decrementing it does the same thing and skips 9.3 however, at 2.1 it skips 2.0 and goes straight to 1.9.
I just can't figure out why its doing this.
I'm pretty sure its not the decimal place issue or even incrementing or decrementing the value as the value when displayed on the serial monitor adjusts correctly. I'm pretty it's an issue with actually writing the digit to the LCD. It just doesn't like the numbers 2.1 or 9.3.
As i'm using large custom characters on a 20x4 LCD display, each of the displayed digits are being created individually by resolving the actual value to a single digit and sending it to the appropriate place on the LCD. In order to isolate the number for the decimal place digit, I'm multiplying the value by 10 to remove the decimal place and then using %10 to get the final number. This is the digit that is sent to the LCD in the decimals position.
Is this the cause of this weird behaviour?
Please go easy on pulling my code to pieces. I'm pretty sure the guru's here will cringe when they see my birds nest of a program but by all means, if there is a more efficient way of doing this I'm all ears.
Also, if a video of the problem would be easier to understand i'll load something on youtube in the morning and provide a link.
i've commented the parts of the code i think are relevant to this problem with asterisks **** to try and help.
I tried popping the code here for reference but it exceeded the 9000 character message size limit, even after chopping it down , so i've attached the .pde file instead.
Thanks
Brew_monitor_Version3.ino (15.7 KB)