I am an electrical engineer, for some reason people think I can program, bleh. This means I have to teach myself and to learn new things and Arduino seems to be very simple and straight forward for some things. I have run in to a snag.
I have a 16x4 LCD and am using I2C bus. Currently I am reading the address and comparing to an address that is predetermined by the manufacturer and then running an if statement. I have everything I want to be displayed and I can scroll. I am having some fun with this. Now, I need to update a number without updating anything else. First I thought subroutine, was told that's not a thing in Arduino, then function, hmmm can I have just this one value change when it changes? I thought maybe a a function that displays this value or maybe just a if function? I cannot seem to understand.
First off it is not at all usual to search for an I2C address, normally you know what address the device is that you want to talk to.
Next when trying to do new stuff don't embed it in lots of other confusing code. Write a cut down version that just shows the problem or technique you want to use.
delay (1); // maybe unneeded?
Yes it is unneeded.
You can not hot plug an I2C device unless you take precautions like ensuring the ground makes contact first, then the power and finally the signals. This takes a special form of connectors, I don't know of any off the shelf ones.
Please read this:- How to use this forum it gives to hints into what other information you need to supply when posting code or questions. If the code it too big then attach it, but you are better off writing code in small bits. Break it up into functions, don't have a great big loop function.
The reason I did not do the attachment was for those on their phones. Some I have seen ask for the print out like I did. I was making sure anyone and everyone could read.
Making it simple... I do the huge loop function until I understand the process and then break it into my functions. This was to show my problem.
That bit about the breaking it into a "cut down version" does help me though. I will start this. I will update just one thing on my screen right now. I want to keep one item constant and another to have a live update. This is confusing to me. I can update an item, but cannot update one while keeping another constant. I cannot seem to grasp this concept. Is there something I am missing?
I think it is the fact that you can write a single character. Also that you can move the cursor ( the point to write ) to be anywhere on the display.
Making it simple... I do the huge loop function until I understand the process and then break it into my functions.
That is exactly the way not to do it. Split your code into functions with the appropriate name. You don't even have to fill them with code at first, just the names to get your processes sorted out. This is called top down design and is acknowledged as the best way to design code.
as part of my hot tub project I used an interrupt to run code to keep the display updated, works well as soon as a variable is changed the display shows it automatically