How to send data to I2c display

Hi everyone.
I have the sketch below that is working fine, except that i can not send some data to the lcd display. I can see to the display the static texts but i can not retrieve the values that i see in serial.
Here is the code and some pics.

code.txt (22.8 KB)

(deleted)

Hi thanks for the reply.
I tried what you suggested but no luck. Any other ideas??

Use code tags for your codes

You have:

     Serial.print(F(" vrm "));Serial.println(vrm_0);
...
     lcd.print("Voltage:    "); lcd.print(vrm_0,1);lcd.print("V  ");
...

vrm_0 is declared as a float with global scope. So both statements should display just fine.
If you are unsure, try with a fixed value e.g.

     vrm_0 = 123.45;
     lcd.print("Voltage:    "); lcd.print(vrm_0,1);lcd.print("V  ");
...

Personally, I find your code hard to follow. You have a mixture of C string functions and C++ String methods. And it would benefit from tidying up.
Hey-ho. You should use the style that suits you (and not me).

I suspect that vrm_0 is getting reset to 0.00 between the Serial.print and lcd.print

David.

Hi thanks again for the answers. I tried my floats with fixed values and they appear just fine. So how can i make the values from serial to appear in the lcd. just to let you know i am not of a programmer guy i have arduino for hobby and play with code from here and there!!! Thank you once more.

johnym30:
So how can i make the values from serial to appear in the lcd.

You obviously know how to put characters on the lcd, the sample code you posted is doing it.

So I'm not sure what the question is.

Serial and lcd objects can both print.
The Serial object sends its output out the serial port, the lcd object sends its output to the LCD.
There is no way to have values you printed using the Serial object to also print out the lcd object.

The Print class used for outputting characters is identical in each so print() works the same for each object.
i.e. Serial.print(xxx) works the same and produces the same character output as lcd.print(xxx)

The biggest difference is that things outside the actual print formatting and character output are different since the device displaying the characters works differently.
The biggest difference between a Display terminal an the LCD is that the LCD does not process line wraps or line endings and is much smaller than a typical display terminal in terms of line size and number of lines.
For example
If you send characters that extend output beyond a line the terminal will wrap to the next line, an LCD won't.
If you call println() it sends and , the terminal will usually process these the LCD won't.
When line wrapping occurs on the bottom line of the display, the terminal will scroll all the previous lines of text up, the LCD wont.

The lcd object also has API methods to set the cursor position the Serial does not.

Because of these differences it isn't as simple as changing all the Serial objects to lcd or duplicating the Serial prints with lcd prints to make things work.
You will have to modify your code appropriately to put the information on the LCD vs the terminal display.

--- bill

I would load all 579 lines of your code into the Arduino IDE editor.
Then press ctrl-T

Print the readable code out on paper.
Then make a very large pot of tea.

With a pencil, identify common sequences of code and tidy them up. e.g. with a helper function.

Draw a flowchart for what your program is actually doing. With your pencil, identify blocks to move or remove.

Then go to bed. Implement your improved program structure in the morning. With a fresh pot of tea.

Believe me. Those 10 sheets of paper, pencil eraser and tea bags cost you about £1.
That £1 would be the best investment you could make.

No, I have made no attempt to read your code. But I bet that after your tea ingestion, you get it down to about 100 lines of maintainable code.

Yes, I stare into a PC screen and get nowhere.
When I have a problem, I print the (formatted) source code. And wonder why I didn't print it sooner!
Oh, I actually print two pages to a sheet. 4 pages double-sided. This only works with human typed lines. i.e. sensible no of chars per line.

David.

Hi everyone,
i finally managed to print my data on the lcd.
They thing is that now, the data on the lcd updates only after the httprequest and when the connection is closed. Without the part of the http request my data updates every 8sec. how i can fix this? Any ideas?
I am posting my code again as i made a 3 part ino file so it can be read moe easily.

wifi manager.txt (8.33 KB)

main ino.txt (6.11 KB)

httprequest.txt (2.72 KB)